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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -