首页 > 编程语言 > 详细

SpringMVC中重定向

时间:2018-03-02 00:21:01      阅读:223      评论:0      收藏:0      [点我收藏+]

1.介绍

  技术分享图片

 

2.index

 1 <%@ page language="java" contentType="text/html; charset=utf-8"
 2     pageEncoding="utf-8"%>
 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 4 <html>
 5 <head>
 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 7 <title>Insert title here</title>
 8 </head>
 9 <body>
10     <a href="RedirectTest">Test Redirect</a>    
11     <br><br>
12 
13     <a href="BeanNameTest">Test BeanNameTest</a>    
14     <br><br>
15 </body>
16 </html>

 

3.concroller

 1 package com.spring.it;
 2 
 3 import org.springframework.stereotype.Controller;
 4 import org.springframework.web.bind.annotation.RequestMapping;
 5 
 6 @Controller
 7 public class RedirectTest {
 8     @RequestMapping("/RedirectTest")
 9     public String hello() {
10         System.out.println("ha ha");
11         return "redirect:/index2.jsp";
12     }
13 }

 

4.效果

  技术分享图片

 

SpringMVC中重定向

原文:https://www.cnblogs.com/juncaoit/p/8490838.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!