Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

set all form parameters using jsp:setProperty  RSS feed

 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!