facebook

Problems with custom tags and jsp tags

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #196442 Reply

    lazarus60
    Member

    It’s been a week and I finally have time to look at this problem again (old post).

    I can’t find any reason why the tag libraries shouldn’t be able to be loaded.

    If I try to reference the taglib from the jsp I get the same error.

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

    gives me this error

    cannot load class: com.myDomain.taglib.ListTei

    the class com.myDomain.taglib.ListTei is referenced from the tags.tld and is a part of the <teiclass> tag in there. If I remove that reference I lose that error but whenever I use any of the custom tags I receive it again with a different class it cannot load. The class it can’t load is the one found in the *.tld file that the tag in question uses.

    I have also noted that the <jsp:useBean> fails to load any of my custom bean classes, same error, different class.

    I can do tag completion still though.

    Any other suggestions on how to fix this?

    Oh, I’m using EA2:

    Version: 2.1.1
    Build id: 200306161200

    -Laz

    #196460 Reply

    Scott Anderson
    Participant

    Laz,

    I’ve kicked this one over to some of our tags experts. One question though, do you have a similar problem with well known tag libraries (JSTL etc), or do they work just fine?

    –Scott
    MyEclipse Support

    #196500 Reply

    No Operation
    Member

    I am also experimenting with own taglibs, but found everything (what I used) to work as expected.

    The taglib is a separate project which is used in the build path of the web project.

    Now I added a tei-class to some tag and it still works. Lucky me – unlucky you…

    Q: Can you instantiate the tei-class from your web project from a Java class?

    class Test
    void foo() {
    com.myDomain.taglib.ListTei tei = new com.myDomain.taglib.ListTei();
    }

    ???

    NOP

    #196783 Reply

    lazarus60
    Member

    I’m back.

    I was experimenting some more with these problems and I think I’ve found a solution. It seems that if I jar up my taglib and then add it to the classpath the tags work. This is also true of all of the unloadable classes. They also seem to work if you have the source in one of your source directories.

    It seems that the JSP compiler can’t load classes from a class folder. Before I had all of my taglib classes held there and it couldn’t load any of them. This was also true of many of my <jsp:usebean/> targets.

    I’m now getting a new error which doesn’t describe itsself at all. All it shows is a path to a class and when I look at the file in question it shows no errors at all.

    Any Ideas?

    #196785 Reply

    Scott Anderson
    Participant

    Very good feedback on the taglib issue. I’ve forwarded the thread along to our JSP editor author for reflection. Can you post exactly what your project structure looked like and what the dependencies between them were when you experienced the problems?

    It seems that the JSP compiler can’t load classes from a class folder.

    I’m a little confused by this. Is this the classes folder in your taglib project, upon which your main project (I assume) was dependent?

    I’m now getting a new error which doesn’t describe itsself at all. All it shows is a path to a class and when I look at the file in question it shows no errors at all.

    Is the problem logged against a Java class or a JSP page? Have you tried manually rebuilding the project? If it still shows up, I know there is a problem right now with how errors are reported when you have an empty errorPage specification in a jsp file (ie. errorPage=””). Could that be it?

    –Scott
    MyEclipse Support

    #196817 Reply

    lazarus60
    Member

    Scott,

    Here’s the basic structure of my project. Since I’m working on an existing proprietary system I am stuck with their structure (to a degree) and do not have access to much of the source code (mostly just class files). My class folder is composed of all of the build classes I’m using for my current project. The contents of this folder changes with each deploy and generation of new DataBean classes (auto-generated from xml). This class folder is actually located outside the project in either a linked directory or in another project (I’ve tried both). The custom taglibs are a part of this class folder. I have a src folder which contains my custom java classes and all of my customized JSPs are found in /WebApp/WEB-INF/web. This creates conflicts with the way myeclipse wants to work of course but I’ve worked around it (multiple WEB-INF never hurt anyone).

    In that setup none of the custom taglibs work and I cannot load any of my DataBean classes using <jsp:useBean> tags. Now if I take the class folder jar it up and add that jar to my classpath all of the issues go away.

    Jarring up that directory is a pain though. Basically to get the <jsp:useBean> tags to work properly I’ll need to re-jar and refresh the class folder and project for each deploy since I never have the source of my DataBeans.

    Also, those weird JSP errors went away when I recreated the project (erase and make new). So there must have been something wonky with my project setup.

    #197028 Reply

    m842834
    Member

    I had a similar problem when using the struts libraries: cannot load class: <whichever Tei was indirectly referenced first>. The only way I was able to resolve it was to recreate my web project using the default directory under eclipse/workspace. I tried experimenting a bit: moved the taglibs around, downloaded some simpler taglibs, copied files from project to project, etc. My taglibs never worked while in a project that’s not in the default directory.

    #197030 Reply

    Scott Anderson
    Participant

    That’s some interesting insight. I do know that the EA2 release had a problem with projects that weren’t in the default location, but I believe it was resolved in the 2.5.0 GA release. If you happen to come across this problem again in the latest release we’d really appreciate some documentation to help us to reproduce it submitted to our Bugs forum.

    –Scott
    MyEclipse Support

    #197796 Reply

    wschung
    Member

    I wonder if the issue mentioned here, ie the problem of loading the tei class defined in a taglib, has been addressed in the GA version. I am using the linux version 2.5. I still encounter this issue when I am using the struts library. I have the same problem even after I update the taglib to the 1.2 syntax, that is using tei-class instead of teiclass.

    Also, the About MyEclipse menu item does not tell me what version I am using.

    #197797 Reply

    Scott Anderson
    Participant

    I wonder if the issue mentioned here, ie the problem of loading the tei class defined in a taglib, has been addressed in the GA version.

    Yes, improvements were made in the Linux version’s support of tag libraries in the 2.5.1 release. Again, this issue is not present in the windows version, but rather only on Linux some taglibs work in 2.5.1, some still do not. However, another issue was identified and it will be addressed in the next service release.

    Also, the About MyEclipse menu item does not tell me what version I am using

    No, you need to open Help > About Eclipse Platform and click on the MyEclipse icon or press the ‘Features’ button.

    –Scott
    MyEclipse Support
    .

    #242001 Reply

    fermataintl
    Member

    This thread seems the closest to my problem, although its quite old! I am running version 4.03 GA and have upgraded to java 5. I have a struts project with a custom taglib that I haven’t touched in a year. I am coming back to it and I have an error indicated in a jsp file that says:

    cannot access fi.els.tags.SpacerTag: bad class file : C:\Documents and Settings\Dean\My Documents\EclipseWorkspace\workspace\banfordsports\WebRoot\WEB-INF\classes\fi\els\tags\SpacerTag.class

    The tag class has compiled without errors. It is located in the path shown in the jsp error.

    Here’s my tld file (els.tld):

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE taglib PUBLIC “-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN” “http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd”&gt;
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>els</shortname>
    <tag>
    <name>spacer</name>
    <tagclass>fi.els.tags.SpacerTag</tagclass>
    <attribute>
    <name>width</name>
    </attribute>
    <attribute>
    <name>height</name>
    </attribute>
    </tag>
    </taglib>

    the jsp file looks like this (abbreviated):
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “DTD/xhtml1-transitional.dtd”>
    <%@ page isELIgnored=”false” %>
    <%@ 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/struts-tiles.tld” prefix=”tiles” %>
    <%@ taglib uri=”/WEB-INF/els.tld” prefix=”els” %>

    <td><els:spacer width=”220″/></td>

    If the resolution to this problem has been discussed elsewhere, I apologize, I did not find it. Thanks for any help you can provide.

    Dean

    #242057 Reply

    fermataintl
    Member

    BTW, I deployed the app to tomcat 5 and it works, so why is there a red X in the jsp, as I described in my last post?

    Dean

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Problems with custom tags and jsp tags

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