How to pass javascript variable to struts2 property tag

后端 未结 1 1495
闹比i
闹比i 2021-01-25 11:54

Here\'s my problem:

When I write this in javascript it works

// OK:

alert(\'

        
1条回答
  •  -上瘾入骨i
    2021-01-25 12:49

    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.

    0 讨论(0)
提交回复
热议问题