web上下文设置及el失效问题解决

来源:互联网 发布:好用的网络电话软件 编辑:程序博客网 时间:2024/06/07 16:07

1、jsp上下文设置及引用

<c:set var="webPath" value="${pageContext.request.contextPath}" scope="request"/><link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />

2、EL表达式不起作用

原因web.xml中用的dtd版本太老导致

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >

修改为:

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">


原创粉丝点击