标签:
----------Controller -------
package com.test.mvc;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class GeneralController {
@RequestMapping(value="index.do")
public String index_jsp(Model model){
model.addAttribute("test","你好!");
System.out.println("index.jsp");
return "index";
}
}
--------------index.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>Insert title here</title>
</head>
<body>
<cut value="${test}"></c
ut>
${test}
</body>
</html>
------------------结果输出---------------------
${test} ${test}
-------------------修改内容----------------------
index.jsp 添加<%@ page isELIgnored="false" %>
结果正常显示:
你好 你好
Spring Mvc中Jsp也页面怎么会获取不到Controller中的数据
标签:
原文地址:http://www.cnblogs.com/starxing/p/5764743.html