Hi,, I am new to JSP. I have developed one simple EMP Info JSP Form. In this I used useBean tag ,and i set all propeties of Java Bean. On Submit, i wrote a servlet. Now how can i get the JavaBean in servlet? (I am able to get each property using request.getParameter()). But how can i get whole JavaBean in the Servlet?
Good old JSP just does not work the way you are thinking. You are using a bean in a request scope, which means that a bean will be taken/created from/into the request when the form is called. The request ends, and your bean is gone too. Bye bye. When you submit the form to your servlet, there's no bean anymore. Even if you'd make a bean in session scope, it would not be automatically populated with your form's input values.
I am able to get each property using request.getParameter()
Then what is the use of useBean, setProperty , getProperty tags in JSP? And now, I have number of fields in the JSP form ,and How can i get the data in the Servlet except getParameter()?
Then what is the use of useBean, setProperty , getProperty tags in JSP?
If a servlet has set a bean in request scope, you can use useBean and getProperty to show the bean's values. If the bean is in a broader scope, like session or application scope, setProperty can be used to set the bean values at request time.
I have number of fields in the JSP form ,and How can i get the data in the Servlet except getParameter()?
Is there something wrong with it ? ;) Unless you use some kind of framework to do the job for you, or unless you make a utility class to do some cool things with request parameters, then you'll have to stick with getParameter, getParameterMap, getParameterNames, getParameterValues.
Karthikean Konangi
Greenhorn
Joined: Jan 31, 2008
Posts: 22
posted
0
Thanks a lot Christophe. Now i got it.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.