How to access request parameters in Struts2?

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

Sort of...

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

I am trying to use a parameter object, but it does not work!

Thanks in advance.

+3
source share
2 answers

Adding Zakhier’s answer from his comment, so the question can be “answered”:

<s:hidden name="myfield" value="%{#parameters['mparam']}"></s:hidden>
+6
source

If you add String getMyParam (), setMyParam (String val) to the action that displays the form, you can use

<s:hidden name="myfield" value="${myParam}" />
+2
source

Source: https://habr.com/ru/post/1713545/