Search code examples
javajspstruts2

How to pass Struts2 property tag as parameter in java function in the jsp?


I am having a problem in passing Struts2 property tag as parameter in java function in the jsp. I am calling a java function like this from jsp,

<s:if test="%{DoSomething()}">

DoSomething() function is in the Action class, and is being called for each record in the iterator.

The problem is that I want to pass this property <s:property value="userId"/> in the function DoSomething as java string as follow.

<s:if test="%{DoSomething("<s:property value="userId">/)}">

Can anyone please guide me that how can I do that. I goggled it but did not find anything.


Solution

  • you cannot used Struts2 tag to another Struts2 tag, you can use expression language, first use <s:set name="userId" value="userId" /> then use ${userId}