Spring MVC - DispatchServlet config

2 minute read


<P><FONT SIZE=2 FACE=”Arial”>web.xml</FONT> </P> <P>        <FONT SIZE=2 FACE=”Arial”>// Spring IOC config</FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>   </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”><</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>context-param</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>       </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”><</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>param-name</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT><FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>contextConfigLocation</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”></</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>param-name</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>       </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”><</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>param-value</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT><FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>/WEB-INF/applicationContext-*.xml</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”></</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>param-value</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>   </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”></</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>context-param</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT> </P> <P>        <FONT SIZE=2 FACE=”Arial”>// Spring MVC config</FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>   </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”><</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>servlet</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>       </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”><</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>servlet-name</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT><FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>action</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”></</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>servlet-name</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>       </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”><</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>servlet-class</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT><FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>org.springframework.web.servlet.DispatcherServlet</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”></</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>servlet-class</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>       </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”><</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>load-on-startup</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT><FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>2</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”></</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>load-on-startup</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT>
<FONT COLOR=”#000000” SIZE=2 FACE=”Courier New”>   </FONT> <FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”></</FONT><FONT COLOR=”#3F7F7F” SIZE=2 FACE=”Courier New”>servlet</FONT><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>></FONT> </P> <P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/DispatcherServlet.html</FONT> </P> <P><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>looks for a spring bean configuration</FONT> </P> <P><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>action’-servlet.xml’</FONT> </P> <P><FONT COLOR=”#008080” SIZE=2 FACE=”Courier New”>the main beans that should defined in this file are</FONT> </P> <P>org.springframework.web.servlet.DispatcherServlet       
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">HANDLER_ADAPTER_BEAN_NAME</FONT>       <FONT SIZE=2 FACE=”Courier New”>"handlerAdapter"</FONT>       
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">HANDLER_EXCEPTION_RESOLVER_BEAN_NAME</FONT>    <FONT SIZE=2 FACE=”Courier New”>"handlerExceptionResolver"</FONT>     
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">HANDLER_MAPPING_BEAN_NAME</FONT>       <FONT SIZE=2 FACE=”Courier New”>"handlerMapping"</FONT>       
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">LOCALE_RESOLVER_BEAN_NAME</FONT>       <FONT SIZE=2 FACE=”Courier New”>"localeResolver"</FONT>       
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">MULTIPART_RESOLVER_BEAN_NAME</FONT>    <FONT SIZE=2 FACE=”Courier New”>"multipartResolver"</FONT>    
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">PAGE_NOT_FOUND_LOG_CATEGORY</FONT>     <FONT SIZE=2 FACE=”Courier New”>"org.springframework.web.servlet.PageNotFound"</FONT> 
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">REQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME</FONT>       <FONT SIZE=2 FACE=”Courier New”>"viewNameTranslator"</FONT>   
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">THEME_RESOLVER_BEAN_NAME</FONT>        <FONT SIZE=2 FACE=”Courier New”>"themeResolver"</FONT>        
<FONT SIZE=1 FACE=”Courier New”>public static final </FONT><FONT COLOR="#0000FF" SIZE=1 FACE="Courier New">String</FONT>       <FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">VIEW_RESOLVER_BEAN_NAME</FONT>         <FONT SIZE=2 FACE=”Courier New”>"viewResolver"</FONT> </P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">http://static.springframework.org/spring/docs/2.0.x/api/constant-values.html#org.springframework.web.servlet.DispatcherServlet.HANDLER_ADAPTER_BEAN_NAME</FONT></P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">http://www.devx.com/Java/Article/29208/0/page/3</FONT> </P> <P><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">http://www4.java.no/javazone/2006/SpringMVC.pdf</FONT> </P>

Categories:

Updated:

Leave a Comment