Balkrishna wrote:
>
> I am forwarding this question once again.I will highly appreciate any help
> on the subject

Your tag handler code looks okay, at least at a brief look. The problem is with
how you deploy the web application and the tag library. See intermixed comments
below.

> > I am trying to use Tag lib on BEA Weblogic server . This is simple Hello
> > World Code
> >
> > Java File ..Saved and compiled in
> > D:\weblogic\examples\webapp\cookie\web-inf folder

I assume WebLogic supports the standard web application deployment
file structure. If so:
* Is D:\weblogic\examples\webapp\cookie the root directory for
  your application, and have you configured WebLogic to recognize
  this as the root for your web application?
* All paths in a web application are case sensitive, so the
  directory that holds classes, TLDs, and other application
  internal files must be called WEB-INF, not web-inf.

Some web containers, such as Tomcat, have a special directory that
serves as the home for auto-deployed applications. If you place the
directory structure for your application in this directory, Tomcat
automatically associates it with a context path that's the same
as the application directory name. WebLogic may have a similar
feature. Read the documentation to find out. Otherwise you have to
tell WebLogic about the location of your web app. Again, read the
docs for how to do that.

> > //Tag Lib
> > [...]

The code seems to be fine (I have not tested it, but I don't see
any obvious errors).

> > Next i hv created taglib.tld and saved this file in
> > D:\weblogic\examples\webapp\cookie\web-inf folder

Same comments as above; make sure WebLogic understands that
D:\weblogic\examples\webapp\cookie is the root dir for your
web application, and change web-inf to WEB-INF.

> > File code as below
> >
> > //Describing ur tags
> >
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > <!DOCTYPE taglib PUBLIC"-//Sun MicroSystem,Inc.//DTD JSP Tag Libary1.1//EN
> > http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
> >
> > <taglib>
> >   <tlibversion>1.0</tlibversion>
> >   <jspversion>1.1</jspversion>
> >   <uri>D:\weblogic\examples\webapp\cookie\web-inf\HelloWorldTag.class<uri>

The <uri> can be anything, but you typically use the recommended
value for the corresponding attribute in the taglib directive used
in the JSP page. In your case this would be "mytags". But, this has
nothing to do with your current problem.

> >   <info>My First Tag Library</info>
> > [...]

The rest of the TLD seems to be fine

> > Next i hv append web.xml file with follwoing code
> >
> >  <taglib>
> >   <taglib-uri>mytags</taglib-uri>
> >   <taglib-location>/WEB-INF/taglib.tld</taglib-location>
> >     </taglib>
> >
> > and saved web.xml file

Fine. This tells WebLogic to look for the TLD in the taglib.tld
file located in the application's WEB-INF directory.

> > Next i wrote simpe jsp and saved in  \weblogic\myserver\public_html

Here there seems to be a problem. If the web applications root
directory is D:\weblogic\examples\webapp\cookie, as it should be
based on where you store the class files and the TDL, you must
put the JSP file in D:\weblogic\examples\webapp\cookie (or a
subdirectory other than WEB-INF).

> > Code of jsp is as follow
> >
> > %@ taglib uri="/Web-inf/taglib.tld" prefix="mt" %>

Here you have two problems:
1) You do not use the correct case for the uri attribute value.
   If you want to refer to the TLD file directly, it should be
   /WEB-INF/taglib.tld
2) You have defined a mapping from a symbolic uri ("mytags")
   to the real location in the web.xml file, but you're not
   using it. So, the best value for the uri attribute is
   "mytags" (however, I've seen reports that WebLogic is buggy
   in this area and may not be able to handle the translation
   from the symbolic name to the real location; if so, use the
   direct reference in 1) and remove the mapping in web.xml).

> > [...]

The rest looks fine.

> > But when i try to run this jsp i get following error
> >
> > javax.servlet.ServletException: compilation of /heloWorld.jsp failed:
> > weblogic.utils.ParsingException: nested IOException: java.io.IOException:
> > cannot resolve '/Web-inf/taglib.tld' into a valid tag library
> > [...]

The message pretty much says it all. If you make the changes I describe,
it should work fine.

<plug>
I describe the web application structure, how to develop and deploy
tag libraries in great detail in my JavaServer Pages book:

  <http://TheJSPBook.com/>

</plug>

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to