Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 - prepopulating a hidden field

 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

I have a JSP page (page.jsp) which is called from another application. The other application passes in query string (page.jsp?setting=123). I want a hidden field on page.jsp to be prepopulated with the value of setting.
I have the following line in page.jsp:

<s:hidden name="param_1" />

which a want to be prepopulated with the value of setting. The tag does not accept a value attribute. How can this be done?

Thanks
eric
 
K Fleischer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of calling the jsp directly, you should call a struts action. The action bean can than hold the parameter and you can set the hidden field by a simple

[ June 26, 2008: Message edited by: K Fleischer ]
 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I'll try that
 
Arun Ak
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<s:hidden name="hiddenname" key="bar" />

ex.
if bar = "testme"
then

hiddenname=testme
 
nillesh patil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K Fleischer wrote:Instead of calling the jsp directly, you should call a struts action. The action bean can than hold the parameter and you can set the hidden field by a simple

[ June 26, 2008: Message edited by: K Fleischer ]



It works thanks buddy !!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic