facebook

JSP Editor – Unknown Tag

  1. MyEclipse Archived
  2.  > 
  3. Web Development (HTML, CSS, etc.)
Viewing 15 posts - 16 through 30 (of 34 total)
  • Author
    Posts
  • #253233 Reply

    cri_tsg
    Member

    I’m using MyEclipse version 4.1.1.

    I created a new WebProject and I was able to get the editor to recognize tags in JSPs. However, to get it to work, I had to put the jsp folder at the same level as WEB-INF. We usually put the jsp folder under WEB-INF to prevent directory browsing (we also use struts to forward to jsps).

    So in my “real” project, I moved my jsp folder up one level to the same as WEB-INF. That didn’t work. I also verified that standard.jar and jstl.jar are in the build path. I also copied them to WEB-INF\lib. I also verified that all tld files are in WEB-INF. None of that helped.

    I’m wondering if there is something else that the JSP editor is looking for. In a previous posting, you said :

    put those JARs into your WEB-INF/lib directory, remove the library and then just mount them from the WEB-INF/lib dir, then close all your editors and rebuild the project, and reopen the file

    I’m not sure I follow. How should I “remove the library” and how do I “mount them”?

    I would prefer not to use the milestone builds yet (especially since it depends upon non-production eclipse 3.2).

    Thanks.
    Morgan

    #253235 Reply

    Riyad Kalla
    Member

    Morgan,
    It could be as simple as you using incorrect @taglib entries, read this tip first, if it doesn’t help, give me your jsp @taglib headers and any web.xml taglib entries you have:
    http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-10906.html

    #253236 Reply

    cri_tsg
    Member

    That’s a really good posting. But I have been following that convention. Here is a set of sample @taglib entries from one JSP of mine:

    
    <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
    <%@ taglib uri="/tags/struts-html" prefix="html" %>
    <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
    <%@ taglib uri="/tags/c" prefix="c" %>
    

    And the corresponding web.xml is:

        
    <taglib>
            <taglib-uri>/tags/struts-bean</taglib-uri>
            <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/tags/struts-html</taglib-uri>
            <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/tags/struts-logic</taglib-uri>
            <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/tags/c</taglib-uri>
            <taglib-location>/WEB-INF/c.tld</taglib-location>
        </taglib>
    

    And just to be sure, I confirmed that all tld files exist in the project’s WEB-INF directory, and the containing folder is listed on the Java Build Path – Source tab.

    Thanks for taking a look at this!

    #253237 Reply

    Riyad Kalla
    Member

    So far so good, ok is this a web project or a Java project? Right click on it and go to properties, do you see a MyEclipse-Web preference panel? If so, what values are in the two text fields?

    If not, you need to right click on your project, go to MyEclipse then “Add Web Capabilities” to allow MyEclipse to understand this project as a web project.

    #253239 Reply

    cri_tsg
    Member

    It’s a java project. I tried to add webproject capabilities, but it doesn’t like my directory structure. I have /src/main/webapp/WEB-INF – and I tried to make that the web root directory, but the wizard complains that “Web-root folder can not reside under a Java source folder.”

    So I tried using /src/main as the web-root, and the wizard accepts that, but it created its own /src/main/WEB-INF directory instead of using my /src/main/webapp/WEB-INF. Anyway, after I copied the tlds to the new WEB-INF the JSP editor recognized the taglibs.

    I had avoided using the WebProject feature because that directory structure doesn’t work with my project. I’m using Maven2 which defines/expects a different structure.

    If there is a way to add WebProject capabilities while pointing to my directory, that would help a lot!

    Since the jars are apparently not needed for the JSP editor, I think the only real problem is that the JSP editor expects the WEB-INF dir to be in a specific location. Make that configurable and I’d be set!

    #253245 Reply

    Riyad Kalla
    Member

    I have /src/main/webapp/WEB-INF – and I tried to make that the web root directory, but the wizard complains that “Web-root folder can not reside under a Java source folder.”

    Your webroot dir would actually be “/src/main/webapp”, but yes, you cannot have your webroot inside of a source dir. Are you actually setting /src/main as a source dir? Why?

    So I tried using /src/main as the web-root, and the wizard accepts that, but it created its own /src/main/WEB-INF directory instead of using my /src/main/webapp/WEB-INF. Anyway, after I copied the tlds to the new WEB-INF the JSP editor recognized the taglibs.

    Don’t do that, only because it will just confuse you. You set the webroot to a dir that it isn’t support to be, then munged around MyEclipse by copying the TLDs into the right location. I would back out all those changes. It’s sort of like trying to save gas by welding the doors on your car shut.

    Since the jars are apparently not needed for the JSP editor, I think the only real problem is that the JSP editor expects the WEB-INF dir to be in a specific location. Make that configurable and I’d be set!

    You are right, it expects the WEB-INF dir to be inside of the WebRoot dir, have a look here at one of the most supported project layouts: http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-11099.html

    The WebRoot dir is what get’s deployed. Give me some indication of what your project layout is, and which dir contains what stuff and I think we can figure something out.

    #253403 Reply

    Mickey Barton
    Participant

    I downloaded 5.0Milestone 1 and eclipse 3.2RC7 and am still getting the error of unknown tag for the tlds that I reference that are not local. Any Idea?

    #253404 Reply

    Mickey Barton
    Participant

    PS I am using Maven 2.0.4 and the latest eclipse Maven2 plugin from codehaus v 0.0.9

    #253405 Reply

    Riyad Kalla
    Member

    mlbartonsr,
    Start giving us information to work with. Is this a web project? If you open the project and go to MyEclipse-Web, what are the two values you have filled out in the text fields? What do your taglib entries look like? Do you have any taglib entries in your web.xml file? If so, what?

    #253407 Reply

    Mickey Barton
    Participant

    This is a web project.
    I am using the maven2 directory structure for web apps. My web-root folder is /src/main/webapp. My context path is /STAR.
    An example of taglibs in my web.xml is:
    <jsp-config>
    <taglib>
    <taglib-uri>/tags/struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/tags/struts-bean.tld</taglib-location>
    </taglib>
    </jsp-config>
    In my jsp page I have:
    <%@ taglib uri=”/tags/struts-bean” prefix=”bean” %>
    <%@ taglib uri=”http://java.sun.com/jsp/jstl/core&#8221; prefix=”c” %>

    I can reference the bean tld fine but when I have a reference to the jstl core tag is displays an unknown tag marker when I am looking at the file in the editor. I do not see anything in the list of the problems tab. I have the filter set to any resource in the same project and all types selected.

    #253408 Reply

    Riyad Kalla
    Member

    Ok everything looks good, you likely just have your URI wrong. If you are using JSTL 1.0 it should be: http://java.sun.com/jstl/core but in 1.1 they changed it to what you have no.

    You can be sure by expanding “standard.jar” inyour path, going into META-INF and opening the c.tld file, look around the 5th tag for something that says “<uri></uri>”, the values between it is the default URI you want to use.

    #253412 Reply

    Mickey Barton
    Participant

    I did like you suggested and found that I have the uri that they specified. Any other ideas?

    #253413 Reply

    Riyad Kalla
    Member

    Sounds like a bug, see if you can create a little test project with all the necesary files, export it to a zip and email it to me: support@genuitec.com ATTN Riyad with a link to this thread so I know why I’m getting it. I’ll test it on this end.

    #253431 Reply

    cri_tsg
    Member

    Here is my project structure:

    \project_root
    ¦
    ¦   pom.xml
    ¦
    +---src
        +---main
        ¦   ¦
        ¦   +---java
        ¦   ¦   +---com...(presentation packages go here)
        ¦   ¦
        ¦   +---resources
        ¦   ¦       ApplicationResources.properties
        ¦   ¦       log4j.properties
        ¦   ¦
        ¦   +---webapp
        ¦       +---css
        ¦       ¦       global.css
        ¦       ¦
        ¦       +---images
        ¦       ¦
        ¦       +---scripts
        ¦       ¦       global.js
        ¦       ¦
        ¦       +---WEB-INF
        ¦           ¦   applicationContext.xml
        ¦           ¦   c.tld
        ¦           ¦   fmt.tld
        ¦           ¦   struts-bean.tld
        ¦           ¦   struts-config.xml
        ¦           ¦   web.xml
        ¦           ¦   x.tld
        ¦           ¦   [...]
        ¦           ¦
        ¦           +---jsp
        ¦                   index.jsp
        ¦
        +---test
            +---java
    

    There is no \lib directory under WEB-INF since I’m using Maven2. It generated the original eclipse project files with paths to the local repository jars as needed.

    As you suggested, I read the link http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-11099.html for the recommended project layout. In fact, the layout is quite similar to what I have. The two main differences are (1)I have my JSPs under WEB-INF/jsp, and (2) the inclusion of the WEB-INF/lib in the WebProject.

    #253440 Reply

    Riyad Kalla
    Member

    mrachell,
    This structure looks workable. Have you tried adding web capabilities with the following settings:
    1) /src/main/java is a Source folder (Project Properties > Java Build Path > Source (tab))
    2) /src/main/resources is a Source folder (same as #1, it will get “built” into the root of WEB-INF/classes)
    3) /src/main/webapp is your WebRoot directory

    MyEclipse might freak out that you don’t have a lib dir, if your deployments fail, try and create an empty one. Also, if autocomplete for taglibs is not working and it doesn’t understand them AND You are adding your JARs to your build path via a Library this is the problem. This was fixed in MyEclipse 5.0Milestone1 however, so if you had time to test Eclipse 3.2M7 and MyEclipse 5.0M1 in a new install, new directories with a new workspace (import your project) you might find that setup more agreeable for you. The peformance is already increased.

Viewing 15 posts - 16 through 30 (of 34 total)
Reply To: JSP Editor – Unknown Tag

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