0

I have such mapping in my controller:

@RequestMapping(value = "events/newEvent", method = RequestMethod.POST)
public ModelAndView getOrganizerForNewEvent(@RequestParam("id") int organizerId){
    OrganizerEntity organizerEntity = organizerDAOService.findById(organizerId);
    ModelAndView modelAndView = new ModelAndView();
    modelAndView.setViewName("/newEvent");
    modelAndView.addObject("organizer", organizerEntity);
    return modelAndView;
}

And such structure in webapp::

And such structure in webapp:

In dev tools request looks right:

In dev tools request looks right

But I get 404 error: But I get 404 error:

What am I doing wrong?

1 Answer 1

1

I think you have an error, because of incorrect view name

modelAndView.setViewName("/newEvent");

You should use name without slash:

modelAndView.setViewName("newEvent");
Sign up to request clarification or add additional context in comments.

2 Comments

After change I get the same error, but message of error is: /events/events/newEvent.jsp
please, try to change "/newEvent" to "newEvent"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.