mvc:view-controller

id="cproIframe_u1507373" height="90" marginheight="0" src="http://pos.baidu.com/acom?adn=4&at=6&aurl=&cad=1&ccd=32&cec=utf-8&cfv=15&ch=0&col=zh-cn&conOP=0&cpa=1&dai=1&dis=0&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DsTb2vQMe8pyb1-3l_126HbKukOjYSoE0piAzn_OYw4hz_UEuNUkPCHBH3dVbQBFW%26ie%3Dutf-8%26f%3D8%26tn%3Dbaidu%26wd%3Dmvc%253Aview-controller%26inputT%3D1817&ltu=http%3A%2F%2Fwww.xuebuyuan.com%2F2174881.html&lunum=6&n=83099053_cpr&pcs=1276x615&pis=10000x10000&ps=124x148&psr=1280x800&pss=1276x615&qn=84b189ef93d65431&rad=&rsi0=960&rsi1=90&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230000FF&rss3=%23444444&rss4=%23008000&rss5=&rss6=%23e10900&rss7=&scale=&skin=&td_id=1507373&tn=text_default_960_90&tpr=1416323159054&ts=1&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1507373" frameborder="0" width="960" allowtransparency="" marginwidth="0" scrolling="no" align="center,center" _xhe_src="http://pos.baidu.com/acom?adn=4&at=6&aurl=&cad=1&ccd=32&cec=utf-8&cfv=15&ch=0&col=zh-cn&conOP=0&cpa=1&dai=1&dis=0&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DsTb2vQMe8pyb1-3l_126HbKukOjYSoE0piAzn_OYw4hz_UEuNUkPCHBH3dVbQBFW%26ie%3Dutf-8%26f%3D8%26tn%3Dbaidu%26wd%3Dmvc%253Aview-controller%26inputT%3D1817&ltu=http%3A%2F%2Fwww.xuebuyuan.com%2F2174881.html&lunum=6&n=83099053_cpr&pcs=1276x615&pis=10000x10000&ps=124x148&psr=1280x800&pss=1276x615&qn=84b189ef93d65431&rad=&rsi0=960&rsi1=90&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230000FF&rss3=%23444444&rss4=%23008000&rss5=&rss6=%23e10900&rss7=&scale=&skin=&td_id=1507373&tn=text_default_960_90&tpr=1416323159054&ts=1&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1507373">
现在的位置: 首页 > 综合 > 正文
RSS

mvc:view-controller

2014年10月01日 ⁄ 综合 ⁄ 共 792字 ⁄ 字号 ⁄ 评论关闭
id="cproIframe_u1788635" height="280" marginheight="0" src="http://pos.baidu.com/acom?adn=3&at=103&aurl=&cad=1&ccd=32&cec=utf-8&cfv=15&ch=0&col=zh-cn&conOP=0&cpa=1&dai=2&dis=0&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DsTb2vQMe8pyb1-3l_126HbKukOjYSoE0piAzn_OYw4hz_UEuNUkPCHBH3dVbQBFW%26ie%3Dutf-8%26f%3D8%26tn%3Dbaidu%26wd%3Dmvc%253Aview-controller%26inputT%3D1817&ltu=http%3A%2F%2Fwww.xuebuyuan.com%2F2174881.html&lunum=6&n=83099053_cpr&pcs=1276x615&pis=10000x10000&ps=326x864&psr=1280x800&pss=1276x615&qn=3bb7a32a30fa958f&rad=&rsi0=336&rsi1=280&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230000ff&rss3=%23444444&rss4=%23008000&rss5=&rss6=%23e10900&rss7=&scale=&skin=&td_id=1788635&tn=text_default_336_280&tpr=1416323159054&ts=1&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1788635" frameborder="0" width="336" allowtransparency="" marginwidth="0" scrolling="no" align="center,center" _xhe_src="http://pos.baidu.com/acom?adn=3&at=103&aurl=&cad=1&ccd=32&cec=utf-8&cfv=15&ch=0&col=zh-cn&conOP=0&cpa=1&dai=2&dis=0&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DsTb2vQMe8pyb1-3l_126HbKukOjYSoE0piAzn_OYw4hz_UEuNUkPCHBH3dVbQBFW%26ie%3Dutf-8%26f%3D8%26tn%3Dbaidu%26wd%3Dmvc%253Aview-controller%26inputT%3D1817&ltu=http%3A%2F%2Fwww.xuebuyuan.com%2F2174881.html&lunum=6&n=83099053_cpr&pcs=1276x615&pis=10000x10000&ps=326x864&psr=1280x800&pss=1276x615&qn=3bb7a32a30fa958f&rad=&rsi0=336&rsi1=280&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230000ff&rss3=%23444444&rss4=%23008000&rss5=&rss6=%23e10900&rss7=&scale=&skin=&td_id=1788635&tn=text_default_336_280&tpr=1416323159054&ts=1&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1788635">

两种用法 

1、重定向 
<mvc:view-controller path="/" view-name="redirect:/admin/index"/> 
即如果当前路径是/ 则重定向到/admin/index 

2、view name 
<mvc:view-controller path="/" view-name=admin/index"/> 
如果当前路径是/ 则交给相应的视图解析器直接解析为视图 
如 
<bean id="defaultViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:order="2"> 
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> 
        <property name="contentType" value="text/html"/> 
        <property name="prefix" value="/WEB-INF/jsp/"/> 
        <property name="suffix" value=".jsp"/> 
    </bean> 

则得到的视图时 /WEB-INF/jsp/admin/index.jsp 

不想进controller,可以在spring-mvc.xml中配置静态访问路径 
Xml代码  
<!-- 访问静态资源文件  -->  
    <mvc:resources mapping="/images/**" location="/images/" cache-period="31556926"/>  
像这样,jsp文件若放在静态路径/images下,可以直接访问,而不经过controller。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值