Search Results

Search found 1 results on 1 pages for 'jeffl8n'.

Page 1/1 | 1 

  • Spring MVC - Set an actionURL parameter with Javascript

    - by jeffl8n
    Is it possible to dynamically set a Spring MVC portlet:actionURL portlet:param using javascript? I have tried with the following code, but the id value always comes across as null to the controller. I have verified that setting the portlet:param manually passes the value correctly: <portlet:param name="id" value="2" /> I have also verified the value in the javascript is being set correctly and is not null. (Note: I've changed the variable names, etc. from the original code to simplify it and obfuscate it since it is my employer's code.) JSP: <portlet:actionURL var="modifyURL"> <portlet:param name="do" value="modify" /> <portlet:param name="id" value="${model.id}" /> </portlet:actionURL> ... <form:form action="${modifyURL}" id="modifyForm" modelAttribute="model"> <form:hidden path="id" id="id" /> </form:form> Javascript called when the update URL is clicked: function update() { document.forms[0]["id"].value = selectedId; document.forms[0].submit(); } Controller: @RequestMapping(params = {"do=modify"}) public void modify(@ModelAttribute("model") Model model, @RequestParam(value = "id", required=true) Long id, ActionRequest request, ActionResponse response, SessionStatus sessionStatus, ModelMap modelMap) { ....

    Read the article

1