Hi, first thing, If your action in HTML form is result.jsp,so you don't need a servlet code. But, if you do want to use servlet code, then set the action to Tester.do.
second thing, in result.jsp, your setProperty tag would only execute if there is no person attribute in your page scope( as you have not specified the scope, it will default to page). If you specify the scope=request, the Container will search for the person attribute in the request scope.
third thing, you have not used the getProperty tag, that's why, your jsp is not displaying anything. use getProperty tag after your jsp:useBean tag ends.
<jsp:useBean id="person" class="com.example.web.Person"> <jsp:setProperty name="person" property="name" value="<%=request.getParameter("userName")%>" /> </jsp:useBean> <h1> The name of the person is: <jsp:getProperty name="person" property="name"/></h1> </body> </html>
In form.html - <html><body> <form action="Tester.do">
Name: <input type = "text" name="userName"> <input type="submit">
Even if you say <form action="result.jsp"> it will work without any problems but since you have a mapping in the web.xml for Tester.do it may be wise to use it.
Let me know if it works.
Joined: Apr 17, 2005
Thank you very much srinath for you help
it did work with me with the solution provided by sushma
the problem was the i didn't use getProperty in my jsp and that's why it wasn't displaying anything when i tested it
but isn't this supposed to dipslay the name ? "<%=request.getParameter("userName")%>"
thanks srinath and sushma for our hlep [ June 17, 2005: Message edited by: Jamed ]