java - Spring 4 : How to map RequestMapping URLs to particular controller -


i have written spring mvc application multiple controllers.

on jsp, have action on form:

 <form id="createtableform" method="post" name="createtable" action="${pagecontext.request.contextpath}/savetable" > 

and same action mapped method in controller:

@controller public class tablecontroller implements tableconstants {    @requestmapping(value="/savetable")   public string savetable(httpservletrequest request,redirectattributes redirectattributes) {   //...   } } 

and in web.xml:

  <context-param>     <description>context name of application</description>     <param-name>contextname</param-name>     <param-value>w****</param-value> </context-param> <context-param>     <description>database used for</description>     <param-name>databasename</param-name>     <param-value>w*****</param-value> </context-param>  <welcome-file-list>     <welcome-file>login.jsp</welcome-file> </welcome-file-list>  <filter>     <filter-name>filterchainproxy</filter-name>     <filter-class>com.abc.w****.configuration.filterchainproxy     </filter-class> </filter> <filter-mapping>     <filter-name>filterchainproxy</filter-name>     <url-pattern>/*</url-pattern> </filter-mapping>  <session-config>     <session-timeout>1</session-timeout> </session-config>   <jsp-config>     <taglib>         <taglib-uri>http://displaytag.sf.net</taglib-uri>         <taglib-location>/web-inf/tld/displaytag.tld</taglib-location>     </taglib> </jsp-config> 

do need include url mapping particular controller in web.xml file or in webappconfig class?

i have webappconfig annotated @configuration, @componentscan , @enablewebmvc. has following methods:

 public urlbasedviewresolver setupviewresolver() {  }  public messagesource messagesource() {  }  public void addresourcehandlers(resourcehandlerregistry registry) {  }  public commonsmultipartresolver multipartresolver() {   } 

please advise.

the @requestmapping annotation applied controller class. in case methods in class derive defaults class annotation , implementation override it.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -