facebook

Why JSTL / JSP validation error

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

    Folks,

    We are receiving a JSP validation error when we add JSTL tags to our JSP pages. We are seeing the following errors:

    1. At the first line of the JSP page, I have the following tag.

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

    There are two JSP validation errors on this line:

    File “http://java.sun.com/jsp/jstl/core&#8221; not found. NOTE: No JSP line number was avaliable so line 1 was used for the marker.

    The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application. NOTE: No JSP line number was avaliable so line 1 was used for the marker.

    Then on another line, there is the JSTL tag declared:

    
    <c:out value='${mfrSkuList.Description}' />
    

    And, there is the following error:

    No tag “out” defined in tag library imported with prefix “c”

    These tags were taken directly from JSTL 1.1 examples provided by Sun.
    Also, the JSP page runs with no errors reported by the Java application server.

    Are the validation errors due to an error in our code or is there a problem with the validator? If it is our code, please let me know how to correct the errors. Thanks

    #226330 Reply

    Riyad Kalla
    Member

    Keith,
    I can’t reproduce this:

    NOTE: Even though the file is shown as ‘changed’ that is because I typed the <c:|(autocomplete) since the last save, where the taglib entry and the <title> text all validated correctly.

    Out of curiosity, can you list (or show a screenshot) of everything on your build path? SOmetimes people will add jasper libraries to thier build path, which is what we use for validation, and it will cause the validation to barf.

    ALSO, you can try a little test case yourself by creating a new Web Project, add the JSTL 1.1 libs to the project and a new JSP page using the JSP wizard and paste in the contents you reported above and just see if it worked.

    #226441 Reply

    Josh Moore
    Member

    I am getting a similar problem but with struts files. I have a line in my jsp <html:hidden property=”key” value='<%=pk%>’/>

    A validation error show up on that line that says:

    Multiple annotations found at this line:
    – cannot resolve symbol: symbol: method setValue(java.lang.Object)
    – unknown tag (html:hidden)

    that shows up on some other simmilar lines also

    I have these taglibs in the jsp
    <%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
    <%@ taglib uri=”/WEB-INF/struts-html.tld” prefix=”html” %>
    <%@ taglib uri=”/WEB-INF/struts-logic.tld” prefix=”logic” %>
    <%@ taglib uri=”/WEB-INF/firps.tld” prefix=”firps” %>

    The page still compiles and runs fine.

    #226444 Reply

    Riyad Kalla
    Member

    Josh,
    If you use double quotes instead of single, does it work? Quoting is actually part of the taglib spec so it does carry some important w.r.t. to processing.

    #228006 Reply

    psbase
    Member

    I have the same problem with my taglibs.

    here a short example:

    <%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>

    now, when I use a c-tag somewhere like this:

    <c:choose>
        [...]
    </c:choose>
    

    I get the following error for my “c:choose” tag:

    taglib directive for “c” does not exist or TLD is not found

    Did I missed something? I guess I must have forgotten to tell MyEclipse where it can find the TLD’s. Can anyone help?

    #228041 Reply

    Riyad Kalla
    Member

    Give this a read, it almost always is the issue: http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-31.html#251

    #243520 Reply

    akwatters
    Member

    I’m also having the same problem after having opened an existing project. The URI is declared in web.xml and matches that defined in the TLD. It works ok in Eclipse WTP.

    Is there anything else to check?

    #243560 Reply

    Scott Anderson
    Participant

    Did you add add the uri mappings in your web.xml file as indicated in the FAQ entry that Riyad posted?

    #243584 Reply

    akwatters
    Member

    Yes, the URI is declared in web.xml. I have also carefully checked that the URI is correct. I have also tried it in JBuilder and Sun Java Studio Creator and all is fine. I’m evaluating IDEs…

    #244050 Reply

    Does ME check all libraries included in a project or simply those located in /WEB-INF/lib?
    I am having troubles here, on a project using Maven. The libraries are located in ~/<user>/.m2/repository and included in the build path. There are no problems whatsoever when I deploy the project to tomcat (using exploded in ME), but I get validation-errors in just about all my jsp’s…

    A couple of other things I can think of that “may” be a root to the problem: (can anyone say if this is a problem please…)
    I use sitemesh to decorate my pages, so no page contains <html><head> etc..
    The taglib-definitions are defined in a single file (“/taglibs.jsp”) that I include in all my other pages.

    I am using ME4.1m2 on eclipse3.1.1 (but had the same problems when using ME4.0)

    Trond.

    #244819 Reply

    shane_a_bell
    Member

    @ovstetun wrote:

    Does ME check all libraries included in a project or simply those located in /WEB-INF/lib?

    Yeah, I’m having the same problem. I’m using maven too and it seems that ME doesn’t search all the libraries in the project, just those in web-inf/lib.

    I added the appropriate jar (that was already in my classpath mind you) to web-inf/lib and it fixed the problem.

    Shane.

    #244821 Reply

    Riyad Kalla
    Member

    Guys,
    Are these JARs not in the workspace somewhere, but are added as External JARs?

    #245319 Reply

    shane_a_bell
    Member

    @support-rkalla wrote:

    Guys,
    Are these JARs not in the workspace somewhere, but are added as External JARs?

    Yeah that’s right. They are external jars.

    I’m using a Maven plugin that refers to dependent jars that are stored in the Maven repository which can be anywhere on the filesystem. In my case, it’s not in the workspace.

    Thanks,
    Shane.

    #245320 Reply

    Riyad Kalla
    Member

    Shane,
    That is the problem. Our taglib parser relies on the JARs to be extensions of IResource (internal to the Eclipse platform), but external JARs are actually handled differently and we haven’t extended it yet to handle that one case. Are you able to put these JARs into the workspace anywhere, even in a dependent Java projects?

    #245324 Reply

    shane_a_bell
    Member

    For the time being I have placed a reference to the taglib in web.xml. This makes it happy and everything works fine.

    You said “we haven’t extended it yet”. Does that imply that this will be fixed in a future release?

Viewing 15 posts - 1 through 15 (of 18 total)
Reply To: Why JSTL / JSP validation error

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