Reputation: 536
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.
Upvotes: 3
Views: 14660
Reputation: 1975
Adding Zahieer's answer out of his comment so the question can be "answered":
<s:hidden name="myfield" value="%{#parameters['mparam']}"></s:hidden>
Upvotes: 6
Reputation: 722
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}" />
Upvotes: 2