tags:

views:

151

answers:

2

I am coming rails framework experience. I have a simple problem.

I have a link on a page. I want some Struts2 action executed when the user clicks the link and want to pass along some parameters.

For example:

link on page = My Link
Action I want to call = myTestAction (it is defined in struts.xml)
parameter I want to pass = typeA=false

How can I do this? I looked at <s:url><s:param name="typeA" value="false"></s:url> tag. However, the parameter doesnt seem to get pass. when I hover on the link i do not see any parameters.

A: 

the action class needs to have setTypeA(String value) and getTypeA() declared in it for the above code to pass typeA=false

I dont know why they would do this...or maybe rails has spoiled me.

ratan
+1  A: 

Try This..

<s:url id="url" action="myTestAction">
    <s:param name="typeA">false</s:param>
</s:url>
<s:a href="%{url}" >My Link</s:a>
Vinayak.B