• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't add taglib element to web.xml

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

my web.xml is based on web-app_2_4.xsd. This web.xml is not supporting <taglib> element. However, if I want to use tlds available through Struts package, I need to include <taglib> element for each tld. How can I accomplish this with this version of web.xml. Also in a book I'm referring to "Beginning Apache Strust - From Novice to Professional" it is mentioned to use web.xml that comes along with Struts ( I have Struts 1.2.7). This web.xml is based on web-app_2_2.dtd which has support for <taglib>.

In my jsp, I want to use


Please let me know how can I add <taglib> to my web.xml which is based on 2.4 xsd.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a Servlet version 2.4 application, any taglib elements must be enclosed in a <jsp-config> stanza. This is a common mistake because Servlet 2.3 did not require this.
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The new recommended way of configuring tag libs are to add the taglib definitions to the top of your JSP like such:
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

The tlds are bundled in the struts jar in Struts1.3.8 so you do not need to configure them in web.xml, thank goodness. I am not sure if they are also bundled in the 1.2.7 struts jar, you will have to check that. If they are not bundled then you are out of luck and will not be able to use the 2.4 xsd.
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to both of you.

Andy, actually the tlds are bundled along with struts 1.2.7 package, though not sure if they are bundled in struts.jar. I'll give a try using the recommendations otherwise I shall switch over to 2.2 version
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Struts 1.2.7, The TLDs are not bundled in any of the jar files. You just have to include them in the WEB-INF directory as is done in the struts-blank.war file that comes with the download.

Andy's statement about not being able to use the 2.4 xsd with Struts 1.2.7 is incorrect. As long as you make the taglib declarations properly, it should work fine.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic