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.
<s:if test="%{DoSomething(userId)}">
您不能将Struts2标记用于另一个Struts2标记,可以使用表达式语言,首先使用<s:set name="userId" value="userId" />
然后使用${userId}
Most likely you wouldn't need to pass in a parameter like this. You are trying to call a method DoSomething from your action class. You want to pass in a parameter to this method in your action class. The userId must be existing already in you action class otherwise you couldn't be able to get it through the s:property tag. You can just use this userId variable in your DoSomething method of your action class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.