1. JSP EL just support by JSP2.0 or above, the servlet 2.3 works for JSP1.2. If we want to use EL in JSP page, we should declare the version of servlet as 2.4 in web.xml.
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.4//EN"
"http://java.sun.com/dtd/web-app_2_4.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
2. If we want refer to a external style sheet or javascript file, the correct link form is:
<link type="text/css" rel="stylesheet" href="pages/css/common.css">
Remember: there is NOT a slash at the beginning of URI.
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.4//EN"
"http://java.sun.com/dtd/web-app_2_4.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
2. If we want refer to a external style sheet or javascript file, the correct link form is:
<link type="text/css" rel="stylesheet" href="pages/css/common.css">
Remember: there is NOT a slash at the beginning of URI.
本文介绍了JSPEL的支持情况及其与JSP版本的关系,指出JSPEL仅支持JSP 2.0及以上版本,并解释了如何在web.xml中声明正确的servlet版本来启用EL表达式。此外,还提供了正确链接外部样式表和JavaScript文件的方法。
362

被折叠的 条评论
为什么被折叠?



