spring中在跳转的jsp页面中用EL表达式获取数据时候,要加上isELIgnored="false",不然是不会解析EL表达式的,但是在就final就不需要
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>商品查询页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="${pageContext.request.contextPath}/item/queryItem.action" method="post">
查询条件:
<table width="100%" border="1px solid red">
<tr>
<td><input type="submit" value="查询"></td>
</tr>
</table>
商品列表:
<table width="100%" border="1px solid red">
<tr>
<td>序号</td>
<td>商品名称</td>
<td>商品价格</td>
<td>商品日期</td>
<td>商品描述</td>
<td>操作</td>
</tr>
<c:forEach items="${list}" var="item" varStatus="start">
<tr>
<td>${start.index+1}</td>
<td>${item.name}</td>
<td>${item.price}</td>
<td>${item.createtime}</td>
<td>${item.detail}</td>
<td><a href="${pageContext.request.contextPath}/item/editItem.action?id=${item.id}">修改</a></td>
</tr>
</c:forEach>
</table>
</form>
</body>
</html>
其中具体的取值如下:
<h4>获取域对象中的值</h4>
<%