facebook

JSTL Not Validating

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #309964 Reply

    Running MyEclipse 8.6M1-20100525 on OSX.

    Created a simple Web Project application on J2EE 5.0 (there was a grayed option displays to add JSTL support when I created the project).

    The top of the page contains:

    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    

    I have a sql:setDataSource tag that doesn’t display any warnings, and added:

    <sql:query var="queryResult" dataSource="${dataSrc}">
    ...my sql query here
    </sql:query>
    

    On the sql:query tag, I have the little yellow warning sign, and the message is “Invalid attribute (dataSource)”.

    I also have in the page body:

    <c:forEach var="row" items="${queryResult.rows}" >
        <c:out value="${row.user_display_nm}" /> <br />
    </c:forEach>
    

    And the little yellow triangle says “Invalid attribute (items)”.

    Right-clicking on the project root displays a grayed-out “Add JSTL Libraries”

    Expanding the Java EE 5 Libraries for the project includes jstl-1.2.jar.

    Running the project fails with:

    org.apache.jasper.JasperException: /tips.jsp(76,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
        org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
        org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
        org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
        org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1173)
        org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:820)
        org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
        org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2359)
        org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2409)
        org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2415)
        org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
        org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2359)
        org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1735)
        org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:184)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:333)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
        org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    

    I haven’t used JSTL in a very long time, but this should be easy. Is there something I’m missing?

    Thanks.

    #309972 Reply

    CasaDelNorte,
    Since you are using J2EE5, jstl1.2, can you change your taglib directive to include /jsp as shown below

    <%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core&#8221; %>
    <%@ taglib prefix=”sql” uri=”http://java.sun.com/jsp/jstl/sql&#8221; %

    Please refer to the following link for further reference –
    1. http://faq.javaranch.com/java/SetupJstlForJsp2
    2. http://www.mularien.com/blog/2008/04/24/how-to-reference-and-use-jstl-in-your-web-application/
    Let me know if that helps.

    #309988 Reply

    That’s it! Thanks.

    #310003 Reply

    Welcome!!
    Do let us know if you have any issues.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: JSTL Not Validating

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in