Announcement Announcement Module
Collapse
No announcement yet.
How to make a generic spring mvc controller using annotations Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to make a generic spring mvc controller using annotations

    hi All,

    I am aware using Spring MVC via XML mapping. Recently I learned about annotations. I am trying to develop a internal framework which will make my project independent of any UI framework. Like I want to introduce the Spring MVC controller just as a guest to my other outside Non Spring Controllers and use it to just delegate Request to a Other Business layers outside Spring MVC framework (from where Other Services and Beans will be called to make It Independent of Spring MVC.)

    My Query is :

    My sample Code looks like this :-

    ---------------------------------------------
    @RequestMapping(value="/*.do" , method=RequestMethod.GET)

    public String dispatchToOutsideSpringMVCLayer
    (final HttpServletRequest req, final HttpServletResponse res,
    @ModelAttribute("FormPage") LoginModel model)
    {
    return "LoginPage";
    }

    ---------------------------------------------

    I want to attain someThing Like this :
    ---------------------------------------------

    @RequestMapping(value="/*.do" , method=RequestMethod.GET) //same

    public String dispatchToOutsideSpringMVCLayer
    (final HttpServletRequest req, final HttpServletResponse res, @ModelAttribute //same
    ("FormPage") Object model) { //different
    LoginModel model = (LoginModel) model;
    return "LoginPage"; //same
    } //same
    ---------------------------------------------

    I am trying to get an Generic Java Object in place of the Specific Model Object (Because it is different for different Forms) and then convert it to the specific Form Object.. Later in the code.

    Kindly advice me on how to acheive the same as I want to make it a Generic Method Call and Independent of Spring MVC. (Or any other UI framework, - as per my Project requiremts considering the Future.)

    Thanks in Advande. )

    Please let me know me about the same:]
Working...
X