Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help on Tag Files - attribute directive.

 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is my code in short. Can someone help. I use tomcat 5.1.15.
===

The Tag File - SmallHeader.Tag
------------------------------



My Jsp - TagFileDemo.jsp
------------------------



===================
The Output I get is
===================


======

Why my attribute value doesn't get printed?

======
 
Bachi Taurean
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Just tried your example and is running perfectly fine. Here is the output I get:

"This is a small included file. Used to demonstrate Tag Files.
This tag has a MANDATORY Attribute. Its value is : Good Morning Mani!



The above output comes from the tag file."

With appropriate font colors. I am using Tomcat5.0.28. For safer side pls check if you are using the right DTD for web.xml and you have included the latest jar's for servlet-api and jsp-api. Just in case...
 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! Though it sounds happy in one side that I have not committed anything wrong in the code, I am puzzled as to why it doesn;t display for me.

Infact I simplified the code for you people. I even displayed the body content using <jsp oBody />. Body content is getting displayed but only attribute is the problem.

So it shouldn't be the web.xml problem. am I right?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it shouldn't be the web.xml problem

It is. Make sure you are using version 2.4, not 2.3.
http://faq.javaranch.com/view?ServletsWebXml
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting this

org.apache.jasper.JasperException: /TagFileDemo.jsp(4,0) No tag "SmallHeader" defined in tag library imported with prefix "mani"
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile

whats wrong ?
 
Bachi Taurean
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Niranjan,

Please make sure if the following are correct in your case

(1) You have your tag file in WEB-INF\tags directory
(2) Your web.xml uses the correct namespace/DTD(latest servlet/jsp spec's).
(3) Go to common\lib directory of tomcat and make sure you have servlet-api.jar and jsp-api.jar there
(4) The Manifest.mf file in servlet-api.jar should have lines something like this:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.1
Created-By: 1.4.2-b28 (Sun Microsystems Inc.)

Name: javax/servlet/
Specification-Title: Java API for Servlets
Specification-Version: 2.4
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: javax.servlet
Implementation-Version: 2.4.public_draft

(5)Similarly the Manifest.mf file in jsp-api.jar should have the following lines:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.1
Created-By: 1.4.2-b28 (Sun Microsystems Inc.)

Name: javax/servlet/jsp/
Specification-Title: Java API for JavaServer Pages
Specification-Version: 2.0
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: javax.servlet.jsp
Implementation-Version: 2.0.public_draft
Implementation-Vendor: Apache Software Foundation
Implementation-Vendor: Apache Software Foundation

(6)Last but not the least check for case sensitiveness.

Do let me know if it solves the problem for you.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i checked everything.
but still
 
Bachi Taurean
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please print the contents of your web.xml file.lets try...
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to rename the tag file in lowercase. I don't know if it's important or not. I've tried under Tomcat5.5 and it worked with uppercase.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic