【问题标题】:jstl and eclipse: maybe EL issuejstl 和 eclipse:可能是 EL 问题
【发布时间】:2012-02-24 11:37:01
【问题描述】:

我正在使用 tomcat 7.0.26 和 indigo eclipse。

我将 jstl jars 放在我的 webapp WEB-INF/lib 它是如何解释的 here。我放了jstl-api-1.2.jar和jstl-impl-1.2.jar。

在我的 webapp web.xml 中,我有:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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">

在我的 .jsp 文件中,我有

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 

我的 .jsp 文件中有一些警告:

  <form> 
        <select id="language" name="language" onchange="submit()">
            <option value="en" ${language == 'en' ? 'selected' : ''}>English</option>
            <option value="it" ${language == 'it' ? 'selected' : ''}>Italian</option> 
        </select> 
    </form>

准确地说:

Multiple annotations found at this line:
- Invalid location of text (''}) in tag 
 (<option>).
- Invalid location of text (') in tag 
 (<option>).
- Undefined attribute name (en).
- Undefined attribute name (language).
- Invalid location of text (${) in tag 
 (<option>).
- Undefined attribute name (:).
- Invalid location of text (' ? ') in tag 
 (<option>).

在“控制台”中,出现以下警告:

At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

我的简单应用无法根据用户语言显示正确的标签。

option-tag/EL 警告是否依赖于 jstl 文件 jar?

【问题讨论】:

    标签: jstl eclipse-indigo


    【解决方案1】:

    试试这个:

    <form> 
        <select id="language" name="language" onchange="submit()">
            <option value="en" <c:out value="${language == 'en' ? 'selected' : ''}"/> >English</option>
            <option value="it" <c:out value="${language == 'it' ? 'selected' : ''}"/> >Italian</option> 
        </select> 
    </form>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-15
      • 2023-03-09
      • 2012-02-28
      • 2021-08-23
      相关资源
      最近更新 更多