aspose file tools*
The moose likes Struts and the fly likes Struts 2 - prepopulating a hidden field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 - prepopulating a hidden field" Watch "Struts 2 - prepopulating a hidden field" New topic
Author

Struts 2 - prepopulating a hidden field

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
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

Joined: Jun 25, 2008
Posts: 5
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

Joined: Apr 25, 2007
Posts: 230
Thanks, I'll try that
Arun Ak
Greenhorn

Joined: Jun 21, 2009
Posts: 21
<s:hidden name="hiddenname" key="bar" />

ex.
if bar = "testme"
then

hiddenname=testme
nillesh patil
Greenhorn

Joined: Apr 05, 2011
Posts: 1
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 !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 - prepopulating a hidden field