Spring Mvc中Jsp也頁面怎么會獲取不到Controller中的數據


----------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}"></cut>
  ${test}
</body>
</html>


------------------結果輸出---------------------
  ${test}   ${test}




-------------------修改內容----------------------
index.jsp 添加<%@ page isELIgnored="false" %>

結果正常顯示:
你好 你好


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM