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

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -