jstl输出不起作用 [英] jstl output doesn't work

查看:66
本文介绍了jstl输出不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个与tomcat 7(7.0.27)兼容的应用程序(为tomcat 5.5开发).我在使用jstl时遇到问题,当我指定时,根本不会输出标签:

I'm working on making an application (developed for tomcat 5.5) to be compatible with tomcat 7 (7.0.27). I'm having problems with jstl, simply tags are not output when I specify:

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

在我的WEB-INF/web.xml文件中(以前使用的是2.4版本).

in my WEB-INF/web.xml file (previously, the 2.4 version was used).

.jsp文件示例:

%@page
   language="java"
   pageEncoding="utf-8"
   contentType="text/html;charset=utf-8"
   buffer="none"
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="uri:path-to-layout/layout" prefix="layout" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<fmt:bundle basename="com.path.to.resources.Labels">

...

<td><input
name="j_username"
id="j_username" 
maxlength="30" 
accesskey="2" 
type="text"
style="width: 150px;"
value="<c:out value="${pageContext.request.remoteUser}" default="" />" /></td>

我收到的不是预期的输出,而是:

Instead of expected output, I receive:

${pageContext.request.remoteUser}

作为文本字段中的值.

我使用JSTL 1.2.1,Tomcat 7.0.27,JSP 2.2.代码会编译,当我将web.xml中的web-app版本从3.0更改为2.4时,它的工作原理是不直接输出这些值(尽管还有其他问题迫使我使用3.0版本).任何想法可能是造成此问题的原因吗?

I use JSTL 1.2.1, Tomcat 7.0.27, JSP 2.2. The code compiles, and when I change web-app version in web.xml from 3.0 to 2.4 it works without outputting those values directly (although there are other issues which force me to use 3.0 version). Any ideas what could be the cause of this problem?

推荐答案

您提到您正在使用JSTL 1.2.1,我认为这是从Glassfish服务器劫持的以下代码:

You mentioned that you were using JSTL 1.2.1, which I assume to be the following ones which are hijacked from the Glassfish server:

  • javax.servlet.jsp.jstl-1.2.1.jar
  • javax.servlet.jsp.jstl-api-1.2.1.jar
  • javax.servlet.jsp.jstl-1.2.1.jar
  • javax.servlet.jsp.jstl-api-1.2.1.jar

但是,根据注释,您似乎仍然在/WEB-INF/lib的117个文件中拥有旧的JSTL 1.0/1.1库:

However, as per the comments you seem to still have the old JSTL 1.0/1.1 libraries among the 117 files in the /WEB-INF/lib:

  • jstl.jar
  • standard.jar
  • jstl.jar
  • standard.jar

那只会有冲突. 删除它们.

That would only have conflicted. Remove them.

这篇关于jstl输出不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆