Hi all,
I am having probs with running the
JSP with custom tags.It just prints Hello Mary on the browser.
I think am wrong in putting the files in the appropriate directories.
So pl help me as to where I have to put tld files,class files and the JSP files.Am using Weblogic 5.1 to run the JSPs.
The .tld files is as follows
<?xml version="1.0" encoding ="ISO-8859-1" ?>
<! DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrbay_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion> <jspversion>1.1</jspversion>
<shortname>mt</shortname>
<info> My first tag</info>
<tag>
<name> helloworld</name>
<tagClass>weblogic.taglib.sample.HelloWorldTag</tagClass>
<bodycontent>empty</bodycontent>
<info> A Hello World Tag</info>
</tag>
</taglib>
---------------------------------------------------------------
This is the JSp file
<%@ taglib uri ="/weblogic/taglib/sample" prefix ="sample" %>
<html>
<head>
<title> HelloWorld></title>
</head>
<body bgcolor = #FFFFFF">
<hr>
<sample:helloworld/>
<hr>
</body>
</html>
------------------------------------------------------------
This is the
Java file
package weblogic.taglib.sample;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
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 Mary");
}
catch(java.io.IOException e)
{
throw new JspTagException("IOError:" +e.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;
}
}
------------------------------------------------------------
This line of code I have put it in properties file
weblogic.httpd.webApp.sample=/weblogic/examples/jsp/tagext/sample
Pl reply
Thanx in advance