facebook

[Closed] Using JSTL in a project

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    pidj
    Member

    hello I am a new user of MyEclipse

    I would like to insert <c:if … tag in my jsp file
    is there an auto completion for those tags with MyEclipse?
    Do I have do insert jars in the lib directory or MyEclipse can do it autmaticly

    thinks

    #243094

    Riyad Kalla
    Member

    1) Make sure you are using a Web Project
    2) Right click on your project, go down to MyEclipse > Add JSTL
    3) Select the version of JSTL you want to add, probably 1.1
    4) Be sure to add the proper <%@ taglib %> entry to the top of your JSP page
    5) Have fun!

    The key here are steps #3 and #4, once you have done that, MyEclipse will properly resolve the tags and give you autocomplete for them.

    #243125

    pidj
    Member

    hello

    Completion works fine thinks !

    but I ve an error when executing my jsp on tomcat saying that the test attribut doesn’t accept expression

    #243127

    pidj
    Member

    an other question …
    adding jstl, involve the creation of .tld files in the WEB INF directory, is it possible to configure MyEclipse to place them in a subdirectory like WEB INF/tld

    thinks a lot for your help

    pidj

    #243129

    Riyad Kalla
    Member

    but I ve an error when executing my jsp on tomcat saying that the test attribut doesn’t accept expression

    Some tags don’t accept expressions. It’s defined in the taglib.

    adding jstl, involve the creation of .tld files in the WEB INF directory, is it possible to configure MyEclipse to place them in a subdirectory like WEB INF/tld

    Not currently, but unless you are using custom URIs in your web.xml file, you don’t even need the TLDs in your WEB-INF dir, you can just erase them (as long as you are not remapping them in your web.xml file)

    The reason for this is that they are all contained in the standard.jar/META-INF directory, which is a valid place according to the web specification for them to be and MyEclipse will honor that.

    #243133

    pidj
    Member

    the tag i am using do accept an expression it is the c:if tag. I use it like this

    
    <c:if test="${not empty patientBean.name}">
    

    But if I add this in my web.xml file everythings work

    
         <taglib>
            <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
            <taglib-location>/WEB-INF/c.tld</taglib-location>
        </taglib>
    

    But by putting this MyEclipse mark an error in the web.xml file

    
    invalid content was found starting with element taglib
    

    thinks you very much

    #243142

    Riyad Kalla
    Member

    But by putting this MyEclipse mark an error in the web.xml file

    Code:

    invalid content was found starting with element taglib

    The format of the web.xml file changed with the web 2.4 spec, you need to wrap your <taglib> entries in <jsp-config> tags, like this:
    <jsp-config>
    <taglib>blahlbha</taglib>
    </jsp-config>

    #243176

    pidj
    Member

    ok thinks, you, it works

    So I need to modify my web.xml manually each time I want to use a new taglib

    #243188

    Riyad Kalla
    Member

    So I need to modify my web.xml manually each time I want to use a new taglib

    Only if you want to use non-default URIs.

    To see what the default URI is, open your TLD file and look around the 5th line or so, you will see:
    <uri>SOME TEXT</uri>

    Where SOME TEXT represents the default URI used by the taglib. If you use this string, you don’t need a custom mapping in your web.xml file.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: [Closed] Using JSTL in a project

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