aspose file tools
The moose likes JSP and the fly likes set all form parameters using jsp:setProperty Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply 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: 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?

Thanks


The biggest bankruptcy is the loss of enthusiasm
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: set all form parameters using jsp:setProperty
 
Similar Threads
Jsps
Multiple submit buttons with JavaBeans
Session Value Persistence
Why will this not work?
passing input type="text" from jsp to bean & using that in servlet