Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Controller redirect to another page
    primarykey
    data
    text
    <p>Hey I got the following problem. This is the content of the jspx file:</p> <pre><code>function postSMTH() { $.ajax({ type: "POST", url: document.getElementById("urltxt").value, data: parameters, }); } &lt;input type="hidden" value="${pageContext.request.contextPath}/foo/foo2/foodat" name="urltxt" id="urltxt"/&gt; &lt;div class="foodat"&gt;&lt;a href="javascript:postSMTH();"&gt;&lt;spring:message code="foo_foo2_foodat_text" text="FOODAT"/&gt;&lt;/a&gt;&lt;/div&gt; </code></pre> <p>So if I push the submit button, the <code>postSMTH</code> function is called and the ajax object is paste to the Controller which look like this:</p> <pre><code>@Controller @RequestMapping(value="/foo") public class FooController { .............. @RequestMapping(value="/foo2", method=RequestMethod.POST) public String homePOST(HttpServletRequest request) { ........ } @RequestMapping(value="/foo2", method=RequestMethod.GET) public String homeGET(HttpServletRequest request) { ........ } @RequestMapping(value="/foo2/foodat", method=RequestMethod.POST) public String doTHAT(HttpServletRequest request) { // check authorization Map fooMap = request.getParameterMap(); // do something in the Database, depending on the paramMap return "redirect:/foo/foo1"; } } </code></pre> <p>Everything is working fine regarding the Database, but the Problem is, that the redirect at the end DOESN'T work. It just stays at the page foo2.</p> <p>I'm new to Spring, maybe its a little mistake somewhere. I just cant make it out by myself.</p> <p>Would be nice if someone would have some hint. Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload