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

springmvc请求小例子

时间:2017-04-24 10:17:00      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:ack   request   attr   turn   page   UI   pre   round   framework   

1.welcome.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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>Welcome</title>
    </head>
    
    <body>
        <span>hello!</span>
        <c:out value="${name}"></c:out>
    </body>
</html>

2.controller

package com.cici.example.view;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/rest/v1")
public class WelcomeController {

    @RequestMapping(value="/hello")
    public String index_jsp(Model model){

        model.addAttribute("name", "CC");
        return "welcome";

    }
}

原理待续...

springmvc请求小例子

标签:ack   request   attr   turn   page   UI   pre   round   framework   

原文地址:http://www.cnblogs.com/cici20166/p/6754847.html

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