aspose file tools
The moose likes Struts and the fly likes How to include a javascript variable in the value field of param, thanks. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "How to include a javascript variable in the value field of param, thanks." Watch "How to include a javascript variable in the value field of param, thanks." New topic
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!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to include a javascript variable in the value field of param, thanks.
 
Similar Threads
Struts2 with Displaytag export option is not working
Ajax not working on IE. Undefined error
jQuery UI tabs not loading in the same tab
Struts 2 and UTF-8
how to set javascript varibale in <s:url><s:param> value attribute