File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes set all form parameters using jsp:setProperty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "set all form parameters using jsp:setProperty " Watch "set all form parameters using jsp:setProperty " New topic

set all form parameters using jsp:setProperty

Vinod Awar
Ranch Hand

Joined: Nov 06, 2006
Posts: 125
Hi all

i was trying to set the bean properties using <jsp:setProperty name="info" property="*"/>
as follows

and in the servlet i get a reference to that bean and try to access the bean properties as shown below. but iam getting null values for both username and password.

Any suggestions?


The biggest bankruptcy is the loss of enthusiasm
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

setProperty will be used when your jsp page is being called, not when the form will be submitted. Which means that nothing will be put into your bean.
You're submitting to a servlet so use methods like ServletRequest.getParamter to get the parameters sent.

Your code would work if you'd be using some 'in-between' jsp with the setProperty tag in it :

login.jsp --[submits to]--> setparams.jsp --[forward to]--> myservlet

[My Blog]
All roads lead to JavaRanch
jQuery in Action, 2nd edition
subject: set all form parameters using jsp:setProperty
Similar Threads
passing input type="text" from jsp to bean & using that in servlet
Multiple submit buttons with JavaBeans
Why will this not work?
Session Value Persistence