facebook

[Closed] JSP Custom Tag

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

    arupsarkar
    Member

    Hi I am trying to build a small J2EE application, I have a JSP page having the following code. I have jstl.jar and standard.jar added as external jars in my project. However the ide is saying c:forEach as unknown tag. Can you please tell me what I need to do. I am accessing the JSP page from a servlet.

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

    <html>
    <head>
    <link rel=”stylesheet” type=”text/css” href=”default.css”>
    </head>

    <body>
    <table>
    <tr>
    <th>Make</th>
    <th>Model</th>
    <th class=”model-year”>Model Year</th>
    </tr>

    <c:forEach items=’${carList}’ var=’car’>
    <tr>
    <td>${car.make}</td>
    <td>${car.model}</td>
    <td class=”model-year”>${car.modelYear}</td>
    </tr>
    </c:forEach>
    </table>
    </body>
    </html>

    #258632 Reply

    arupsarkar,

    You have to add TLD libraries to your Web Project Module. The easiest way to do this is calling ‘Add JSTL libraries’ from MyEclipse menu. It will add necessary TLD libraries and JSTL jars

    Regards,
    Snjeza

    #258667 Reply

    Riyad Kalla
    Member

    arupsarkar,
    Snjeza is correct, there is currently a limitation/bug in MYEclipse that it doesn’t parse external libraries for TLD files, so it’s *missing* the TLD file in the standard.jar/META-INF directory, so you need to add it directly to your project, easiest way is what Snjeza suggested.

    #258718 Reply

    henk
    Member

    Riyad,

    I’m very confused about your last post. We use .tld’s in our jar files all the time and never had a problem with it. Occasionally we update the .tld file in a jar file (we build a lot of custom tags in seperate projects) and replace an old jar in a web project with the updated one. Sometimes (but only sometimes) the editor doesn’t pick up new attributes we added to custom tag. Usually after closing the editor or restarting Eclipse solves this.

    So, just to sum up:

    -we have -tons- of .tld’s in the META-INF directory of countless jars
    -we have -no- indidividual .tld files directly in our web-app.
    -tags from taglibs are recognized and autocompletion works

    Is this ‘supposed’ to fail only on a specific version of Eclipse/MyEclipse? As you may know from my post history, we’re using quite a lot of different Eclipse versions and this is one of the things that has always worked.

    #258730 Reply

    arupsarkar
    Member

    Riyad and Snjeza: Thanks very much for your reply, I have added all the JSTL libararies to my project, just wanted to confirm what modification should I make in my XDoclet tag for jsptaglib property for the attribute destinationFile.

    Regards
    Arup

    #258784 Reply

    Riyad Kalla
    Member

    henk,
    I think you read a little too far into my post, the problem is specifically with JAR’s that are added to the build path as “External JARs”, everything else works fine.

    Arup,

    just wanted to confirm what modification should I make in my XDoclet tag for jsptaglib property for the attribute destinationFile.

    I’m a bit confused about your question, are you using XDoclet to generate a taglib and you are asking me how to change the destinationFile or are you asking about something related to JSTL?

    #258823 Reply

    arupsarkar
    Member

    Riyad: My JSP which I mentioned in this post was working fine, with jstl.jar and standard.jar added in my classpath, then I put in the XDoclet tags in my servlet like @jboss.web and similar tags, my JSP page stopped working, I think mytaglib.tld (with errors) got generated. So I followed the myeclipse tutorial http://www.myeclipseide.com/Articles/XDocletWebTutorial.html.

    I just want my JSP page to work. Please let me know if I need to zip the project and attach it to this service request.

    Regards
    Arup

    #258840 Reply

    Riyad Kalla
    Member

    Arup,
    This is very strange, just because you generated an invalid TLD file that shouldn’t have stopped the JSTL tags from working in your JSP. Can you export this project to an archive and email it to me at support@genuitec.com ATTN Riyad? I’ll have a look at it for you.

    Please include a link to this thread so I know why I’m getting the file.

    #259111 Reply

    Riyad Kalla
    Member

    Arup,
    I got your projects, fixed some of the errors and sent it back to you. I hope that helps.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: [Closed] JSP Custom Tag

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