mercredi 1 avril 2015

Using a JS and JSP function in submit form

I have this JS function


The function is returns "/outstanding-appeals-nonstop16/insertForm"



function access() { <% String insert = request.getParameter("insert"); %> `
var insert2 = "<%=insert%>";
return ("/outstanding-appeals-nonstop16/" + insert2 + "/");
}


In my form I have



<form:form commandName = "aNewForm" action = "javascript:access()" method ="POST">
</form:form>


insertForm is a method in the controller. If I put action = "/outstanding-appeals-nonstop16/insertForm" I get the result I am looking for. But I think the action is just calling the JS function instead of the value given from the JS function.


Aucun commentaire:

Enregistrer un commentaire