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;
        }
    
        
    
    }
  • 相关阅读:
    使用Spring RestTemplate 发送 List<MultipartFile>,上传多个文件
    二分查找的非递归实现
    图的深度优先遍历和广度优先遍历
    快速排序学习
    szwl面试记录
    Mycat对Mysql进行分库分表
    Java使用队列解决约瑟夫问题
    pa_hzzx面试总结
    Linux pam 后门纪录root用户密码以及自己设置root密码登录root
    JSP线程安全
  • 原文地址:https://www.cnblogs.com/lantu1989/p/6424283.html
Copyright © 2011-2022 走看看