zoukankan      html  css  js  c++  java
  • SpringMVC Controller 的简单应用

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop.xsd
            http://www.springframework.org/schema/tx
            http://www.springframework.org/schema/tx/spring-tx.xsd
            http://www.springframework.org/schema/mvc
            http://www.springframework.org/schema/mvc/spring-mvc.xsd" >
    
        <!-- springmvc核心配置文件 -->
        <!--  映射处理器 --> 
          <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" /> 
        <!-- 拦截的URL:  /lf/list.test -->
        <bean class="cn.zr.pringmvctest.BeanController" name="/lf/list.test"></bean>
    
    
    
    </beans>     
    package cn.zr.pringmvctest;
    
    import javax.naming.ldap.Control;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.Controller;
    
    public class BeanController implements Controller {
    
        @Override
        public ModelAndView handleRequest(HttpServletRequest arg0,
                HttpServletResponse arg1) throws Exception {
            
            System.out.println("进入BeanController。。。");
            ModelAndView modelAndView = new ModelAndView("/WEB-INF/jsp/list.jsp");
            
            return modelAndView;
        }
    
        
    
    }
  • 相关阅读:
    计算数组的逆序对个数
    处理类型(typedef,uisng,auto,decltype)
    constexpr与常量表达式(c++11标准)
    const的限定
    void*类型的指针
    linux终端拖动鼠标总是产生ctrl+c
    Linux hrtimer分析(2)
    Linux hrtimer分析(一)
    Alarm(硬件时钟) init
    第十一章 Android 内核驱动——Alarm
  • 原文地址:https://www.cnblogs.com/lantu1989/p/6424283.html
Copyright © 2011-2022 走看看