基于annotation注解的Spring3 MVC Page Redirection Example之三页面重定向学习笔记

基于annotation注解的Spring3 MVC Page Redirection Example之三页面重定向学习笔记

一,项目结构图

基于annotation注解的Spring3 MVC Page Redirection Example之三页面重定向学习笔记

com.jiangge.common.controller.WebController

package com.jiangge.common.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class WebController { @RequestMapping(value = "/index", method = RequestMethod.GET) public String index() { return "index"; //返回index.jsp视图 } @RequestMapping(value = "/redirect", method = RequestMethod.GET) public String redirect() { return "redirect:finalPage"; } @RequestMapping(value = "/finalPage", method = RequestMethod.GET) public String finalPage() { return "final"; //返回final.jsp视图 } }

/Spring3MVCDemoPageRedirect/WebRoot/WEB-INF/jsp/index.jsp

Spring Page Redirection重定向
Spring 页面重定向
Click below button to redirect the result to new page
点击下面的按钮,重定向到新的页面,也即 index.jsp 重定向到 final.jsp

/Spring3MVCDemoPageRedirect/WebRoot/WEB-INF/jsp/final.jsp

Spring MVC 表单处理
Redirected Page
重定向到的结果页面 final.jsp

/Spring3MVCDemoPageRedirect/WebRoot/WEB-INF/HelloWeb-servlet.xml

vc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

/Spring3MVCDemoPageRedirect/WebRoot/WEB-INF/web.xml

Spring Page Redirection 重定向 HelloWeb org.springframework.web.servlet.DispatcherServlet 1 HelloWeb / encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encodingFilter /* index.jsp

基于annotation注解的Spring3 MVC Page Redirection Example之三页面重定向学习笔记

参考:

http://www.tutorialspoint.com/spring/spring_page_redirection_example.htm

分类:默认分类 时间:2015-02-27 人气:4
本文关键词:
分享到:

相关文章

Copyright (C) quwantang.com, All Rights Reserved.

趣玩堂 版权所有 京ICP备15002868号

processed in 0.187 (s). 10 q(s)