java - Struts2 param tag with javascript -


I am new to Struts2, but now I am struggling with a problem for 2 days.

Actually, I have a & lt; S: param & gt; tag to s: url & gt;

With the content of one tag somewhere else in the page

  & lt; Div id = "div1" & gt; My values ​​& lt; / Div & gt; & Lt; S: url action = "myAction" var = "url" & gt; & Lt; S: Ultimate Name = "Supreme 1" & gt; ... content of div1 ... & lt; / S: Ultimate & gt; & Lt; / S: URL & gt;  

When I joined & lt; S: param & gt; Javascript call is not evaluated if you try to embed some javascript calls within the tag.

My question is: whenever it is evaluated

Unfortunately this & lt; S: param> gt; It is not possible with the tag because this tag is provided before the page has been served to the user (i.e. it will have to populate the link that allows the browser to move to javascript).

Although with load loader you are trying to do this, there is a jQuery example below that you can complete it:

  $ (document) Ready (function () {var theDivContents = $ ('# div-id'). Text (); var newLinkHref = $ ('# link-id'). Attr ('href') + "and divContents =" + theDivContents ; $ ('# Link-id'). Entry ('href', newLinkHref);});  

Another option, if you go to & lt; Div & gt; , then you want to use a link as the ultimate, you present the link and then enter it & lt; S: param> gt; Tags:

  & lt; Div id = "div1" & gt; $ {YourValue} & lt; / Div & gt; & Lt; S: url action = "myAction" var = "url" & gt; & Lt; S: Ultimate Name = "Supreme 1" & gt; $ {YourValue} & lt; / S: Ultimate & gt; & Lt; / S: URL & gt;  

Comments