| Author |
How to include a javascript variable in the value field of param, thanks.
|
Raimann Zhao
Greenhorn
Joined: Aug 31, 2011
Posts: 1
|
|
Pass a value from the js in one jsp page to struts 2 servlet.
The struts 2 action name is myaction.
In the jsp page, I have below function.
function(){
...
myid=document.getElementById("idValue");
dispName('<s:url value="myaction.action"><s:param name="id" value="myid"/></s:url>');
...
}
In the myaction action class, the id value is null, and I checked it in the Chrome seems myaction.action didn't take id as a param.
If I just replace value="myid" to value="%{'1234'}", I'll get the id value 1234 in myaction class.
Based on it, I guess the only problem is the js variable myid has not been passed to id.
I tried value="myid", value="#myid", value="%{myid}", value="%{#myid}", they all won't work. Almost every possible cases...
Can anybody help me? Thanks!
|
 |
 |
|
|
subject: How to include a javascript variable in the value field of param, thanks.
|
|
|