Skip to main content
Tweeted twitter.com/StackTridion/status/922256201286606849
edited tags
Link
Rick Pannekoek
  • 21.4k
  • 1
  • 18
  • 30
Bumped by Community user
deleted 47 characters in body
Source Link
Bart Koopman
  • 29.6k
  • 3
  • 40
  • 90

I am having this issue where I am able to display a pagePage using Spring MVC Controller

 @RequestMapping(value = "/example/user", method = RequestMethod.GET)
public ModelAndView showForm() {
    System.out.println("#############Hellooo I was here#################");
    return new ModelAndView("user", "user", new UserForm());
}

This is displaying a user.jspuser.jsp as expected. Now from this User.JspUser.Jsp I am submitting a form which is like this

 <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
    <head>
    </head>
    <body>
        <h3>Welcome, Enter The Employee Details</h3>
        <form:form method="POST" action="/example/userdetails" modelAttribute="user">
             <table>
                <tr>
                    <td><form:label path="firstName">Name</form:label></td>
                    <td><form:input path="firstName"/></td>
                </tr>
                 <tr>
                    <td><form:label path="email">Email</form:label></td>
                    <td><form:input path="email"/></td>
                </tr>
                <tr>
                    <td><input type="submit" value="Submit"/></td>
                </tr>
            </table>
        </form:form>
    </body>
</html>

For some reason the control doesntdoesn't seem to be going to this method

 ` @RequestMapping(value = "/example/userdetails", method = RequestMethod.POST)
    public String submit(@ModelAttribute("user")UserForm user, 
      BindingResult result, ModelMap model) {
        System.out.println("#############Hellooo I was here ->submit#################");
        if (result.hasErrors()) {
            return "error";
        }
        model.addAttribute("firstName", user.getFirstName());
        model.addAttribute("email", user.getEmail());
        return "view";
    }

Do with DXA/Tridion web app we need to do some settings to enable postPost operations? As GetGet seems to be working fine.

I am having this issue where I am able to display a page using Spring MVC Controller

 @RequestMapping(value = "/example/user", method = RequestMethod.GET)
public ModelAndView showForm() {
    System.out.println("#############Hellooo I was here#################");
    return new ModelAndView("user", "user", new UserForm());
}

This is displaying a user.jsp as expected. Now from this User.Jsp I am submitting a form which is like this

 <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
    <head>
    </head>
    <body>
        <h3>Welcome, Enter The Employee Details</h3>
        <form:form method="POST" action="/example/userdetails" modelAttribute="user">
             <table>
                <tr>
                    <td><form:label path="firstName">Name</form:label></td>
                    <td><form:input path="firstName"/></td>
                </tr>
                 <tr>
                    <td><form:label path="email">Email</form:label></td>
                    <td><form:input path="email"/></td>
                </tr>
                <tr>
                    <td><input type="submit" value="Submit"/></td>
                </tr>
            </table>
        </form:form>
    </body>
</html>

For some reason the control doesnt seem to be going to this method

 ` @RequestMapping(value = "/example/userdetails", method = RequestMethod.POST)
    public String submit(@ModelAttribute("user")UserForm user, 
      BindingResult result, ModelMap model) {
        System.out.println("#############Hellooo I was here ->submit#################");
        if (result.hasErrors()) {
            return "error";
        }
        model.addAttribute("firstName", user.getFirstName());
        model.addAttribute("email", user.getEmail());
        return "view";
    }

Do with DXA/Tridion web app we need to do some settings to enable post operations? As Get seems to be working fine.

I am having this issue where I am able to display a Page using Spring MVC Controller

@RequestMapping(value = "/example/user", method = RequestMethod.GET)
public ModelAndView showForm() {
    System.out.println("#############Hellooo I was here#################");
    return new ModelAndView("user", "user", new UserForm());
}

This is displaying a user.jsp as expected. Now from this User.Jsp I am submitting a form which is like this

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
    <head>
    </head>
    <body>
        <h3>Welcome, Enter The Employee Details</h3>
        <form:form method="POST" action="/example/userdetails" modelAttribute="user">
             <table>
                <tr>
                    <td><form:label path="firstName">Name</form:label></td>
                    <td><form:input path="firstName"/></td>
                </tr>
                 <tr>
                    <td><form:label path="email">Email</form:label></td>
                    <td><form:input path="email"/></td>
                </tr>
                <tr>
                    <td><input type="submit" value="Submit"/></td>
                </tr>
            </table>
        </form:form>
    </body>
</html>

For some reason the control doesn't seem to be going to this method

@RequestMapping(value = "/example/userdetails", method = RequestMethod.POST)
public String submit(@ModelAttribute("user")UserForm user, BindingResult result, ModelMap model) {
    System.out.println("#############Hellooo I was here ->submit#################");
    if (result.hasErrors()) {
        return "error";
    }
    model.addAttribute("firstName", user.getFirstName());
    model.addAttribute("email", user.getEmail());
    return "view";
}

Do with DXA/Tridion web app we need to do some settings to enable Post operations? As Get seems to be working fine.

added 624 characters in body
Source Link

For some reason the control doesnt seem to be going to this method

 ` @RequestMapping(value = "/example/userdetails", method = RequestMethod.POST)
    public String submit(@ModelAttribute("user")UserForm user, 
      BindingResult result, ModelMap model) {
        System.out.println("#############Hellooo I was here ->submit#################");
        if (result.hasErrors()) {
            return "error";
        }
        model.addAttribute("firstName", user.getFirstName());
        model.addAttribute("email", user.getEmail());
        return "view";
    }

Do with DXA/Tridion web app we need to do some settings to enable post operations? As Get seems to be working fine.

Do with DXA/Tridion web app we need to do some settings to enable post operations? As Get seems to be working fine.

For some reason the control doesnt seem to be going to this method

 ` @RequestMapping(value = "/example/userdetails", method = RequestMethod.POST)
    public String submit(@ModelAttribute("user")UserForm user, 
      BindingResult result, ModelMap model) {
        System.out.println("#############Hellooo I was here ->submit#################");
        if (result.hasErrors()) {
            return "error";
        }
        model.addAttribute("firstName", user.getFirstName());
        model.addAttribute("email", user.getEmail());
        return "view";
    }

Do with DXA/Tridion web app we need to do some settings to enable post operations? As Get seems to be working fine.

Source Link
Loading