Announcement Announcement Module
No announcement yet.
how to map from servlet to servlet? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to map from servlet to servlet?

    Hi all,

    i will like to ask this question. The current spring example illustrate on mapping from a controller to a jsp page.What if i have to do in certain situations such as from this controller go to another controller before reaching a jsp page , as my concept always go through a controller first before reaching a view,so if for example login page unsuccessful eg.loginController unsuccessful -> startingController b4 outputting desired result in a jsp page.BTW i'm quite a asking quite a lot.i will be grateful if there's some examples to illustrate thanks.

  • #2
    There's nothing to prevent your controllers from knowing about each other through dependency injection. E.g.

    public class LoginController implements Controller {
        private Controller startingController; // setter ommitted
        public ModelAndView handleRequest(...) {
            if (unsuccessful) {
                return startingController.handleRequest(...);
            return ...;
    But that's also not the only way to implement this kind of rule (e.g. Spring Security uses a ServletFilter to detect and redirect on unsuccessful authentication).