1.项目使用spring security做了安全管理(这应该不是问题吧?)
2.我的jsp页面放在WEB-INF目录下
3.我的jsp页面,page1.jsp包含head.jsp,下面贴出代码:
page1.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:include page="/WEB-INF/jsp/common/header_basic.jsp">
<jsp:param name="pageTitle" value="首页"/>
</jsp:include>
<body>
页面内容
</body>
<jsp:include page="/WEB-INF/jsp/common/foot_basic.jsp"/>
head.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri= "/struts-tags" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>标题:${pageTitle }</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">
</head>
我取到的页面标题总是
求帮助
好吧,我自己解决了,网上很多文章根本自己没验证过哈,误人子弟
在取数据的时候,应该从request对象当中取,el表达式呢${pageTitle}自然是取不到的,正确的写法应该是
${param.pageTitle}