且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将javascript变量传递给struts2属性标记

更新时间:2023-10-25 19:09:04

Struts标签,如JSTL,EL等......都是在服务器端执行的。执行完所有这些操作后,只有HTML的最终页面将呈现给客户端。只有这样,javascript才能在页面上运行。

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.

你不能混合使用javascript和Struts标签。

You can't mix javascript and Struts tags.

另外,考虑不使用静态方法调用,您可以通过调用action方法执行此操作,执行与 Util.getSomeInformation 方法相同的检查。

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.