【SimpleUrlHandlerMapping】逆水行舟用力撑,一篙松劲退千寻。这篇文章主要讲述SimpleUrlHandlerMapping相关的知识,希望能为你提供帮助。
< ?xml version="1.0" encoding="UTF-8"?>
< beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsd
">
< bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
< !--< property name="mappings"> < props>
< prop key="/hello.do"> firstController< /prop> < /props> < /property> -->
< property name="urlMap">
< map>
< entry value="https://www.songbingjia.com/android/firstController" key="/hello.do"/>
< /map>
< /property>
< /bean>
< !--视图解析器-->
< bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
< property name="prefix" value="https://www.songbingjia.com/WEB-INF/"/>
< property name="suffix" value="https://www.songbingjia.com/android/.jsp"/>
< /bean>
< bean class="Controller.FirstController" id="firstController"/>
< /beans>
package Controller;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by Administrator on 2017/8/14.
*/
public class FirstController implements Controller{
public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
ModelAndView mv=new ModelAndView();
//可以设置数据数据放入该容器,可以在页面el表达式获取
mv.addObject("uname","Y2165就业对口专业100%");
//设置视图名称
mv.setViewName("index");
return mv;
}
}
推荐阅读
- 新知食APP架构分析--北京食物科技有限公司旗下产品
- 202. Happy Numberleetcodejava,hashSet,算法
- .NET轻量级ORM组件Dapper修炼手册
- Windows文件复制软件合集(10种最佳免费TeraCopy替代品)
- Windows最佳音乐制作软件推荐(免费FLStudio代品合集)
- Windows磁盘分析器推荐(8种最佳免费WinDirStat替代品)
- Windows磁盘管理工具合集(10种最佳Clonezilla替代品)
- Windows桌面管理软件(9种最佳免费Stardock Fences替代品)
- 文件传输软件推荐(Windows、Mac和Linux的12大FileZilla替代品)