jsp - Struts2 href trigger an action with parameter -
i have link in jsp this
<a href="<s:url action="aurlaction" />">a variable</a>
the struts2 action code
public someaction extends actionsupport{ private string avariable; // avariable getters , setters public execute(){ dosomething(avariable); } }
strtus2 mapping
<action name="aurlaction" class="***.someaction"> <result>....</result> </action>
how can pass in avariable
clicking <a>
tag. want pass in text between <a></a>
action. thanks.
you can pass parameter :
<s:url var="test" action="aurlaction"> <s:param name="avariable">value</s:param> </s:url> <a href="${test}">test</a>
Comments
Post a Comment