• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Custom tag clarification

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pardon if this is elementary but I would appreciate some help getting the correct file structure for the custom tag development. Right now my JSP setup has:
/JSP root web app (putting my jsp's in here)
/JSP/WEB-INF/classes (putting my beans and servlets in here)
I tried the Sun tutorial and the Jakarta tutorial and also looked at the examples included with Tomcat under webapps but have not succeeded correctly placing the taglib, web.xml, and the tag handler class file. Currently have the my calling jsp in /JSP, web.xml and the taglib in /WEB-INF and my tag handler class in /classes.
Any guidance or referal to clear documentation?
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It isn't an elementary question. Lot of people get struck with this.....
General guidelines:
1. When using Beans and Custom Tags, put them in packages. When you don't use packages, you must put the class files in the WEB-INF/classes folder. However, when accessing them in your JSP, the app server class loader (atleast for Tomcat server) looks for the class files in the same package that your generated Servlet code (for the JSP) is located. Obviously, your Bean/Tag class is NOT in that package. So errors follow. To aviod these, put your Beans/Tags in packages.
2. In Tomcat, there seems to be a bug (4.0.1 version) which doesn't load your Tag libraries from the TLD's available in your WEB-INF/ folder. So you are forced to use the < taglib > element of your webapp element in your web.xml (DD) to load the required tag library TLD files.
3. The DD, web.xml, file must be in WEB-INF dir. The Bean/Tag classes must be in the corresponding dir hierarchy under WEB-INF/classes/<packages go here>/.class files. If you have them in jars, place them in WEB-INF/lib dir.
- satya
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic