1

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?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Saro
  • 810
  • 2
  • 12
  • 22

1 Answers1

2

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.

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243