tags:

views:

2395

answers:

2

Hi,

I am trying to access request parameters on a web page and trying to set a hidden fields value to the passed parameter. How can I achieve this using struts2 tags?

Something like...

<s:hidden name="myfield" value="#parameters['myparam']"/>

I have tries using the parameters object but it does not work!

Thanks in advance.

+1  A: 

If you add a String getMyParam(),setMyParam(String val) to the action rendering the form then you can use

<s:hidden name="myfield" value="${myParam}" />
andynu
A: 

Adding Zahieer's answer out of his comment so the question can be "answered":

<s:hidden name="myfield" value="%{#parameters['mparam']}"></s:textfield>
Brian Yarger