I have the following code in JSP that would call an action method and then pass a parameter value.
<s:param name="lastname" value="outputData.Lastname"></s:param>
<li> Your fullname is: <s:property name = "fullname" value="%{getFullname(lastname)}"/> </li>
This is how it looks like in the action method:
public String getFullname (String lastname) throws Exception {
String firstname = someClass.getFirstname();
return firstname + lastname;
}
Unfortunately, when I use the param name to pass the value, the passed value is null. But when I do it like the code below, it successfully passes the value.
<li> Your fullname is: <s:property name = "fullname" value="%{getFullname('Doe')}"/> </li>
The
<s:param>tag doesn't work for setting a value to the variable. You should use<s:set>tag. It will create a variable in theactionscope which is used by default.