in MVC controller, for example
TestController extends MultiActionController
1. 转到空白页面
public ModelAndView testMVC(HttpServletRequest req,HttpServletResponse res) throws Exception {
return null;
}
2. 转到空白页面,并打印字符
public ModelAndView testMVC(HttpServletRequest req,HttpServletResponse res) throws Exception {
res.getOutputStream().write(new String("testString").getBytes());
return null;
}
3. 转到系统错误页面
3.1 forward to one jsp and set the HTTP_STATUS in jsp file :
<%
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
%>
3.2 set the HTTP_STATUS in MVC Controller.
public ModelAndView testMVC(HttpServletRequest req,HttpServletResponse res) throws Exception {
res.setStatus(401);
return null;
}
4. Redirect in Spring MVC
public ModelAndView testMVC(HttpServletRequest req,HttpServletResponse res) throws Exception {
String view = "redirect:"+redirectPath; -- redirectPaht must including the "http://"
return new ModelAndView(view, model);
}
分享到:
相关推荐
基于SpringMVC Mybatis Shiro Redis 的权限管理系统,该系统已经部署到线上,线上访问地址:http://shiro.itboy.net,登录账号:admin 密码:sojson,,详细教程参考sojson.com/shiro
SpringMVC ---- HelloWorld ---- 代码 SpringMVC ---- HelloWorld ---- 代码 SpringMVC ---- HelloWorld ---- 代码 SpringMVC ---- HelloWorld ---- 代码 SpringMVC ---- HelloWorld ---- 代码 SpringMVC ---- Hello...
基于SpringMVC、Mybatis、Redis、Freemarker的Shiro管理Demo源码的升级版 相关详细配置说明请参看 --> http://www.sojson.com/shiro
swagger-springmvc-1.0.2/swagger-springmvc-1.0.2-javadoc/swagger-springmvc-1.0.2-sources
SpringMVC-Mybatis-Shiro-redis-master..............
这是一个网上书城项目,采用当前最流行的框架Spring-SpringMVC-MyBatis设计,主要是对之前用Jsp/Servlet做的一些优化,重构了整个系统,感觉还不错,学到了很多新的知识,能对SSM框架熟练的运用了。 这是一个网上...
OA系统-springMVC/Mybatis/Mysql/Bootstrap OA系统-springMVC/Mybatis/Mysql/Bootstrap OA系统-springMVC/Mybatis/Mysql/Bootstrap
这是一个springmvc-config.xml文件,<?xml version="1.0" encoding="UTF-8"?> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:...
springmvc-framework-官方中文版
SpringMVC-Activiti5.16-Shiro-EasyUI,以前CSDN有的资源找不到了,新上传一个
SpringMVC------从HelloWorld开始
微信 java weixin-java-tools-springmvc-master 微信 java weixin-java-tools-springmvc-master
springmvc-json-lib.rar springmvc-json-lib.rar
ssm-springMVC-整合Quartz(解决了无法注入service问题).doc
jetty-maven-springMVC-mybitas-eclipse集成demo 数据库配置:/jetty-maven/src/main/resources/applicationContext.xml 数据库导入到test数据库:/jetty-maven/src/main/resources/hms_user.sql 配置好maven环境,...
easyui的tree组件的使用,使用springmvc作为后台支持,前后通信是实现tree的操作
springMVC-myBaties整合,springMVC-myBaties整合springMVC-myBaties整合
springmvc-without-webxml springmvc-without-webxmlspringmvc-without-webxml
springmvc-base-quick.rar
搭建SpringMVC spring hibernate 实现项目登录注册 增删查改以及分页查询 代码简洁明了,其中需要自己先建Mysql数据库,数据表 后台通过hibernate自动生成。