• SpringMVC


     <context:component-scan base-package="cn.wwy.controller"></context:component-scan>
    <!--处理器映射器-->
       <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></bean>
    
        <mvc:resources mapping="/img/**" location="/img/"></mvc:resources>
    
        <!--前端控制器-->
       <bean id="firts" class="cn.wwy.controller.SpringMVC"></bean>
    <!--视图解析器-->
       <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
           <property name="prefix" value="WEB-INF/jsp/"></property>
           <property name="suffix" value=".jsp"></property>
       </bean>
        <!--处理映射器的第二种实现-->
    <!--
        <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    <prop key="/hello.do">firts</prop>
                    <prop key="/firts.do">firts</prop>
                </props>
            </property>
        </bean>-->
    <!--处理映射器的第二种实现-->
        <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="UrlMap">
                <map>
                    <entry key="/hello.do" value="firts"></entry>
                </map>
            </property>
        </bean>
    
        <!--拦截器-->
       <!-- <mvc:interceptors>
            <mvc:interceptor>
                <mvc:mapping path="/**"/>
                <bean class="cn.wwy.interceptor.MyIntercptor"></bean>
            </mvc:interceptor>
        </mvc:interceptors>-->
    </beans>
    public class SpringMVC implements Controller {
        public ModelAndView handleRequest(HttpServletRequest Request, HttpServletResponse Response) throws Exception {
           ModelAndView mv=new ModelAndView();
           mv.addObject("msg","wwy");
           mv.setViewName("index");
            return mv;
        }
    }
  • 相关阅读:
    pip 笔记
    Codeforces Round #739
    leetcode周赛 248
    AcWing周赛 6
    AcWing周赛 5
    算法提高--最长上升子序列一
    算法提高--数字三角形模型
    数据结构--线段树
    leetcode周赛 243
    AcWing周赛 1
  • 原文地址:https://www.cnblogs.com/xiaoyu1997/p/6694064.html
Copyright © 2020-2023  润新知