Here's my problem:
When I write this in javascript it works
// OK:
alert('<s:property value="@my.package.utils.Util@getSomeInformation(1000)" />');
But when I try to set that value dynamically in the property tag, nothing is being executed.
// NOT OK:
var value = 1000;
alert('<s:property value="@my.package.utils.Util@getSomeInformation(' + value + ')" />');
Can someone please help me in this?
Struts Tags, like JSTL, EL, etc... are executed server side. After all of them are executed, the final page with HTML only is rendered to the client. Only then, javascript can run on the page.
You can't mix javascript and Struts tags.
Also, consider not using static method calls, you can probably do this with a call to an action method, performing the same checks that Util.getSomeInformation
method does.
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.