Discussions

Web tier: servlets, JSP, Web frameworks: About JSP Templates

  1. About JSP Templates (1 messages)

    I need to apply Templates concept in JSP in my application. I refered many websites and other applications and got brief idea about it. However i can't find answers for the following.

    1. <%@ taglib uri='template.tld' prefix='template' %>. What is this tld file?. Do i need to create it and where to save it. I am using resin server. If i comment this code i get a blank jSP page.

    2. What texts should i include in tld file. Is it dependent on my application details or is it independent of any application.(I opened sample file and found xml like format and found its contents are completely different from page where it is called.)

    3. Do i need to create properties page save it as .properties. i am asking this because i opened a jar and found .properties files there where all the contents of various web pages are included.I noticed that it is from this file webapage calls particular string using JSP Template tag to retrieve appropriate text. where i have to save it?.
  2. About JSP Templates[ Go to top ]

    The TLD file is the "Tab Library Descriptor" for the custom tag library you are using. The TLD (along with the Java code) describes which the tags and their attributes in the library.

    Presumably, you are using some of custom tag library for your template logic. This custom tag library should come with the necessary TLD file. Consult the documentation of the library to figure out where it is.

    The <%@ taglib %> directive is the used to import the tag library into your page. You will need to add this directive to every page that uses the custom tags. Again, your custom tag library documentation should cover this.