SpringMVC Controller 的简单应用
2024-08-24 09:01:41
<?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;
} }
最新文章
- MDK for ARM (keil) 编译后的信息
- AC日记——紧急措施 openjudge 1.7 22
- php 生成随机字符串 abcdeft....789
- Linux下使用autoconf 和 automake 编译简单的HelloWorld
- java 20 - 6 加入了异常处理的字节输出流的操作
- Redis Sentinel哨兵集群
- spring配置定时器的时间设置
- Haproxy安装及配置(转)
- Windows下TEX排版论文攻略—CTeX、JabRef使用心得
- Models and the ServiceManager
- .net+easyui系列--按钮
- nginx 502
- 如何利用express新建项目(上)
- BZOJ 2822: [AHOI2012]树屋阶梯 [Catalan数 高精度]
- Linux系统(X64)7 安装Oracle11g完整安装图文教程另附基本操作
- Swift3 颜色转换成图片Image
- CentOS下tar解压 gz解压 bz2等各种解压文件使用方法
- android中配置文件property的用途以及使用<;转>;
- opencv之图像拼接
- [cnBeta]阿里云推出全栈IPv6解决方案 加速推进下一代互联网应用