This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


JavaRanch » Java Forums » Java » JSP
Bookmark "set all form parameters using jsp:setProperty " Watch "set all form parameters using jsp:setProperty " New topic
Author

set all form parameters using jsp:setProperty

Vinod Awar
Ranch Hand

Joined: Nov 06, 2006
Posts: 129
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?

Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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
 
Have you checked out Aspose?
 
subject: set all form parameters using jsp:setProperty
 
jQuery in Action, 3rd edition