How to pass javascript variable to struts2 property tag

Here is 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 this value dynamically in the property tag, nothing happens.

//NOT OK:

var value = 1000;

alert('<s:property value="@my.package.utils.Util@getSomeInformation(' + value + ')" />');

Can someone please help me with this?

+1
source share
1 answer

Struts Tags, such as JSTL, EL, etc., are executed on the server side. After all of them are completed, the final page with HTML is only displayed to the client. Only then can javascript work on the page.

You cannot mix javascript and struts tags.

, , , , Util.getSomeInformation.

+2

All Articles