<%@ page contentType="text/html;charset=GB2312" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><html>
  <head>
  <title>测试你的第一个使用到JSTL的网页</title>
  </head>
  
  <body>
  <c:out value="欢迎测试你的第一个使用到JSTL的网页"/>
  </br>你使用的浏览器是:</br>
  <c:out value="${header['User-Agent']}"/>
  <c:set var="a" value="David O'Davies"  />
  <c:out value="David O'Davies" escapeXml="true"/>
  </body>
</html>代码如上,我的运行结果是
————————————————
“你使用的浏览器是:”————————————————
其他信息出不来。
请帮个忙吧,实在是没分了。

解决方案 »

  1.   

    我用的是TOMCAT,
    该文件位置:tomcat/webapps/jspbook/ch07/helloJSTL.jsp其他已有的可能相关文件为
    webapps/jspbook/WEB-INFO/web.xml
    webapps/jspbook/WEB-INFO/lib/jstl.jar
    webapps/jspbook/WEB-INFO/lib/standard.jar
    webapps/jspbook/WEB-INFO/lib/xalan.jar
    其中web.xml下载来时就有的,我没有改动,内容如下:
    <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd"><web-app>  <display-name>Webdav Content Management</display-name>
      <description>
         Webdav Content Management
      </description>  <servlet>
        <servlet-name>webdav</servlet-name>
        <servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>listings</param-name>
          <param-value>true</param-value>
        </init-param>
        <!-- Uncomment this to enable read and write access -->
    <!--
        <init-param>
          <param-name>readonly</param-name>
          <param-value>false</param-value>
        </init-param>
    -->
        <!--load-on-startup>1</load-on-startup-->
      </servlet>  <!-- The mapping for the webdav servlet -->
      <!-- Using /* as the mapping ensures that jasper, welcome files etc are
           over-ridden and all requests are processed by the webdav servlet.
           This also overcomes a number of issues with some webdav clients
           (including MS Webfolders) that do not respond correctly
     to the
           redirects (302) that result from using a mapping of / -->
      <servlet-mapping>
        <servlet-name>webdav</servlet-name>
        <url-pattern>/*</url-pattern>
      </servlet-mapping>  <!-- ================ Security Constraints for Testing =============== --><!--
      <security-constraint>
        <web-resource-collection>
          <web-resource-name>The Entire Web Application</web-resource-name>
          <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
          <role-name>tomcat</role-name>
        </auth-constraint>
      </security-constraint>  <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>Tomcat Supported Realm</realm-name>
      </login-config>  <security-role>
        <description>
          An example role defined in "conf/tomcat-users.xml"
        </description>
        <role-name>tomcat</role-name>
      </security-role>
    -->  <welcome-file-list>
        <welcome-file/>
      </welcome-file-list>  </web-app>