The incoming request URL looks like: /{root}/Details/View/{id}. I have a servlet DetailsController which based on if a person is logged in or not will show either the "Edit" view or the "Details" view:
if (user != null) {
detailsViewModel.setUser((User) user);
getServletContext().getRequestDispatcher("/edit.jsp").forward(request, response);
} else {
getServletContext().getRequestDispatcher("/details.jsp").forward(request, response);
}
In the edit view there is a form that has an action="Update" and I just want it to go to the UpdateController on /{root}/Update but it's trying to go /{root}/Details/View/{id}/Update. I've set the context root but to avail.
If I put action="/Update", it tries to go localhost:8080/Update without the root. Is this because I am using the forward? How can I fix this? Let me know if I'm missing details you need.