How to write 2 controllers in spring MVC -


Is it possible that 2 controllers such as DispatherServet in Spring MVC write more than one time when we develop spring MVC applications Are there.

Yes .. !! it's possible. You must set a @RequestMapping annotation at the class level, the value of that annotation will be the prefix of all the requests that come with that controller.

Example:

For 1 admin: @controller @ request mailing ("test") public class test controller {} < / Code>

For the second controller:

  @Controller @RequestMapping ("demo") public class DemoController {}  

If there are different / different methods of the two controllers, then you can reach

  & lt; Your server & gt; / Test / & lt; Request Method Mapping & gt; & Lt; Your server & gt; / Demo / & lt; Request Method Mapping & gt;  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -