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: > For the second controller: If there are different / different methods of the two controllers, then you can reach
@Controller @RequestMapping ("demo") public class DemoController {}
& lt; Your server & gt; / Test / & lt; Request Method Mapping & gt; & Lt; Your server & gt; / Demo / & lt; Request Method Mapping & gt;
Comments
Post a Comment