• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to include a javascript variable in the value field of param, thanks.  RSS feed

Raimann Zhao
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!