Edimar, What you need to do is have a form on an html page that posts to the servlet. handle the database access and data validation there, then and add the return data to the request, or the session and then forward it to the proper jsp page for display. (if the object is added to the session the bean scope is session, if request then the scope is request) for instance public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String username = req.getParameter("USERNAME"); String password = req.getParemeter("PASSWORD"); //do your dta validation, database access, and data processing then.. ImaginaryUserObject IUO = new ImaginaryUserObject(thereturndata); req.setAttribute("theIUO", IUO); RequestDispatcher rd = req.getRequestDispatcher("/displaypage.jsp"); rd.forward(req, resp); } then in your jsp get an instance of the object and display the data the data is
hope this helps, Matt Goss Edilmar Alves wrote: > Hi, > > I'm new into JSP technology. > I have used only Servlets before, > with JBuilder 3 Enterprise. > > I would like to know a system with > JSP+Servlets to make something like > these steps I have into my servlet: > > 1) I have a HTML
with a text > field. The user types a username > that should be searched into a > database. > > 2) JSP receives a request and call > a servlet to verify the username. > DOUBT: How to start the communication > between JSP and Servlet and > how to send username data ? > > 3) Servlet searches for username into a > database. If there is, it should return > all records matching this name with the > fields Name/Address/etc; otherwise, it > should return an error msg. > DOUBT: Is it possible to return a Query > result object from Servlet to JSP? > How to return error msg ? > > 4) JSP should receive the Query (or error msg) > and format the HTML output to the browser. > > At my servlets, many times I need to do something > like this: > if ("some code condition") > out.println(" else if ("some other code condition") > out.println(" ... > else > out.println(" This is a simple example of HTML code that is > linked to logic conditions. I think this type > of code has to stay at Servlet, not JSP,isn't it?