Question

I am using Struts 2 and JavaScript. I want to edit a parameter value or add parameter to URL with JavaScript to make dynamic parameter. I can not set value for param why this not have id. Any other form of do?

var urle = document.getElementsByName("vari");          
    urle.value = 5;
<s:url var="urlex" action="actionDo"><s:param name="vari" value=""/></s:url>
Was it helpful?

Solution

Struts tags are JSP tags that compiled and executed on server, JavaScript is executed on client browser. You can't access the server from javascript code without making ajax request. But you don't need too. Use

var url = '<s:url var="urlex" action="actionDo">' +'?vari=' + val;

OTHER TIPS

You have to set jsonObject when this action class has been called. So according to set parameter it will set parameter dynamic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top