I have 4 types of requests handled by 4 different methods in AccountsController:
/accountsDisplays all the accounts/accounts/newNew accounts page/accounts/{accountId}/editEdit account page/accounts/{accountId}/deleteDeletes an account
(1) is fine. I just return the DisplayAccounts.jsp view.
Regarding (2) and (3), When I take the user from initial view to DisplayAccounts.jsp (once the action is successful), the URL is still the old one (either /accounts/new or /accounts/{accountId}/edit respectively)
And with (4), I dont have a view to start with. It’s just an action, which should return the view EditAccount.jsp on failure and DisplayAccounts.jsp on success. And again, the final URL should be /accounts/{accountId}/edit or /accounts respectively.
How do I accomplish this?
You don’t have to associate jsp with the controllers function. Just dn’t return ModelAndView but void and it will call the function and wont call any view.