码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMVC---@PathVariable

时间:2017-12-02 20:22:13      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:com   占位符   mvc   html 4.01   ext   div   span   ack   title   

承接一二章

 

支持占位符

index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello World</title>


  
  <body>
    <a href="springMVC/pathVariable/1">pathVariable</a>
    
  </body>
</html>

test.java

package com.hdxy.domian;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 流年拓荒者
 * 
 *
 */
@RequestMapping("springMVC")
@Controller
public class Test {
   final public String SUCCESS="loginSuccess";
   /*
    * */
   @RequestMapping("/pathVariable/{id}")
   public String pathVariable(@PathVariable("id")Integer id){
       System.out.println("pathVariable"+id);
       return SUCCESS;
   }
   
   
}

 

SpringMVC---@PathVariable

标签:com   占位符   mvc   html 4.01   ext   div   span   ack   title   

原文地址:http://www.cnblogs.com/lnthz/p/7955294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!