Hi All!!!
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
//Tag Lib
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.JspTagException;
public class HelloWorldTag implements Tag
{
private PageContext pageContext;
private Tag parent;
public HelloWorldTag()
{
super();
}
public int doStartTag() throws javax.servlet.jsp.JspTagException
{
return SKIP_BODY;
}
public int doEndTag() throws javax.servlet.jsp.JspTagException
{
try
{
pageContext.getOut().write("Hello World!");
}
catch(java.io.IOException ex)
{
throw new JspTagException("IO Error:"+ex.getMessage());
}
return EVAL_PAGE;
}
public void release()
{
}
public void setPageContext(final javax.servlet.jsp.PageContext PageContext)
{
this.pageContext=pageContext;
}
public void setParent(final javax.servlet.jsp.tagext.Tag parent)
{
this.parent=parent;
}
public javax.servlet.jsp.tagext.Tag getParent()
{
return parent;
}
}
Next i hv created taglib.tld and saved this file in
D:\weblogic\examples\webapp\cookie\web-inf folder
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>
<info>My First Tag Library</info>
<tag>
<name>helloworld</name>
<tagclass>weblogic.examples.webapp.cookie.web-inf.HelloWorldTag</tagclass>
<bodycontent>
empty
</bodycontent>
<info>Hello World Tag </info>
</tag>
</taglib>
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
Next i wrote simpe jsp and saved in \weblogic\myserver\public_html
Code of jsp is as follow
%@ taglib uri="/Web-inf/taglib.tld" prefix="mt" %>
<html>
<head>
<title>Hello World</title>
</head>
<HR>
<mt:helloworld />
</html>
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
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:182)
at
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:16
4)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:99)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:123)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:742)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:686)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:247)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:361)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
Am i following right procedure to run Tag lib
Will any one help me??
BR
Balkrishna R Parab
===========================================================================
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