注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Search的博客

不断学习中!

 
 
 

日志

 
 

Spring MVC(非注解)整理  

2014-09-12 09:33:02|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
具体使用大致分为如下几步:
1.首先在web.xml里面制定让spring接管url映射
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLoinwidt> 04725lt" cla
<inwt;p3-com-topt/
&t;polame>lt;i.blogispatche)/2)+/gt;
<init-paolamad> -onass="nuplt;i1olamead> -onass="nuplt;ivlet-nolamegt;
<servolamrServletl=hemeglt;init-pname>
<servlet-name>dispatcherServlet</servlet-name&gㄈ胋r>ts/?nlt;i*itMolameㄈ胋r>ts/?nlt;ivlet-nolamegt;
'blhemeglt;init-olameml/ns/jlt;init-vlets">vletsn> 窒韗e>2.编写相应的aramborder继承br>mborder接口即可vlets"url映射
assk{
 mborder;vletsletim id= mlns=utrl=HlmiMacn0letim id= mlns=utrl=Macn0let0letim id= mlnsxframework/jav.HjavSt;dispReqution0letim id= mlnsxframework/jav.HjavSt;dispResplofe;vletsletim id= let-class>org.springframeworkMmborder;vletsletblog.1l映射< HeollWorldbr>mborderima="scumes br>mborder{0let	opt  assk{
 mborder;vletsletim id= mlns=utrl=HlmiMacn0letim id= mlns=utrl=Macn0let0letim id= mlnsxframework/jav.HjavSt;dispReqution0letim id= mlnsxframework/jav.HjavSt;dispResplofe;vletsletim id= let-class>org.springframeworkMmborder;vletsletblog.1l映射< Inpndbr>mborderima="scumes br>mborder {0let	opt   	&.cor("urSe	<" =0let		MacolamStpt/<, Stpt/come-file窒淼">vletsn>
謕TF-8"%@ass
 /" thstysequtio e =br>m-naP>the =0letStpt/< bm/rP>thstysequtio e =.org/
()+"oun"+sequtio e =St;derN<()+"o"+sequtio e =St;derPid=()+r>th+"/"=0let%lt;init-0letolam!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.lasTima/g. onal//ENb-app_2_5olamiceslt;init-ist>eet"lt;init-isist>bm/r           mboribcr>m-nh="4.pc ideb-app_2_5lt" c&.c bdjav-equiv
<3.cg.1id="r>m-nh="0b-app  

	Stpt/< m-naTo="to=(Stpt/<)sequtio e =Attptbuteo"webzj_c") =0let	>
	Stpt/< m-na2To="to=(Stpt/<)sequtio e =Attptbuteo"m-na") =0let>
	%lt;init--name&gphid or:#;?xl v="true">sskgrot-d idom/: seeb-appolam%=m-naTo="to %lt;iolam/phidlt;init-sskgrot-d idom/: seeb-appolam%=m-na2To="to %lt;iolam/phidlt;init-0let周url映射
come-2file窒淼">vletsn>
謕TF-8"%@ass
 /" thstysequtio e =br>m-naP>the =0letStpt/< bm/rP>thstysequtio e =.org/
()+"oun"+sequtio e =St;derN<()+"o"+sequtio e =St;derPid=()+r>th+"/"=0let%lt;init-0letolam!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.lasTima/g. onal//ENb-app_2_5olamiceslt;init-ist>eet"lt;init-isist>bm/r           mboribcr>m-nh="4.pc ideb-app_2_5lt" c&.c bdjav-equiv
<3.cg.1id="r>m-nh="0b-app  



<" imis="i.blodit imis=/lt;init-4.在上一步指定的topt/
&t;p(这分竽配置文件名称以及路径都是可以在上一步更改的)中配置tcn控制器和相应的页面spri路謑et周url映射
<?xml version="1.0" encoding="UTF-8"bema/ n="2.5" 
x:xsiclass>org.sprletk/1rg/2/bema/"謑eton="2.e"
xmlns:xsi="http://www.w3.org/2001/XMLSch謑etontance"
xsi:schemaLoca:xsiclass>org.sprletk/1rg/2/bema/bdjavoun:xsiclass>org.sprletk/1rg/2/bema/-topt/<-bema/e/web-app_2_5olam!scr吕隋spri eollWorldbr>mborderd="lass="mborder.HeollWorldbr>mborderb-app_2_5 aolam韗oonety <="w&from=b-app_2_5 alt" ci.blogisp>eoll lcolam/i.blogisp謑etolt" c享roonetylt;i謑etolt" c韗oonety <="w.loP{ b-app_2_5 alt" ci.blogisp/gtme-file>ii.blogisp謑etolt" c享roonetylt;i謑etoolam/bemalt;init-lolambemaght pinpndbr>mborderd="lass="mborder.Inpndbr>mborderb-app_2_5 aolam韗oonety <="w.loP{ b-app_2_5 alt" ci.blogisp/gtme-file>ii.blogisp謑etolt" c享roonetylt;i謑etoolam/bemalt;init-olam/bemaslt;init-謑ets">vletsn> 窒韗e>
"> "> iv> ">