InsertTag doesn't Implement Tag?

I'm trying to create a tag to implement templates. I'm using the PetStore as an example. I get to this point but I do not understand the message! Is not TagSupport implementing the Tag interface? The tag InsertTag extends TagSupport and calls super() in the constuctore?

Can anyone help me with the cause of this message?

Parsing of JSP File '/template.jsp' failed:

--

/template.jsp(-1): Error in tag library at: 'j2ee': error introspecting class: 'admin.taglib.InsertTag': weblogic.servlet.jsp.JspException: (line -1): Error in tag library at: 'j2ee': class admin.taglib.InsertTag doesn't implement javax.servlet.jsp.tagext.Tag

probably occurred due to an error in /template.jsp line -1:

[751 byte] By [slavkoj] at [2007-9-26 9:42:16]
# 1

> Error in tag library at: 'j2ee': class

> admin.taglib.InsertTag doesn't implement

> javax.servlet.jsp.tagext.Tag

This indicates you have not full/correctly implemented the in TagSupport interface. Which methods have you implemented and do they follow these signatures exactly ?

public int doStartTag()

throws JspException

{

return SKIP_BODY ;

}

public int doEndTag()

{

return EVAL_PAGE ;

}

}

If they do, post the code and i'll give it a spin.

MartinS. at 2007-7-1 21:16:01 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Thanks for you help Martin. Attached is the source of InsertTag and templates.jsp I'm using Weblogic server 5.1 and VisualCafeeEE 4.5

package admin.taglib;

import javax.servlet.jsp.JspTagException;

import javax.servlet.jsp.tagext.TagSupport;

import admin.control.web.Parameter;

import admin.control.web.ScreenFlowManager;

import admin.control.util.WebKeys;

import util.Debug;

public class InsertTag extends TagSupport {

private boolean directInclude = false;

private String parameter = null;

private Parameter parameterRef = null;

private ScreenFlowManager screenManager;

public InsertTag() {

super();

}

public void setParameter(String parameter){

this.parameter = parameter;

}

public int doStartTag() throws JspTagException {

try{

pageContext.getOut().flush();

} catch (Exception e){

}

try{

screenManager = (ScreenFlowManager)pageContext.getServletContext().getAttribute(WebKeys.ScreenManagerKey);

} catch (NullPointerException e){

throw new JspTagException("Error extracting screenManager from session: " + e);

}

if ((screenManager != null) && (parameter != null)) {

parameterRef = (Parameter)screenManager.getParameter(parameter,pageContext.getSession());

} else {

Debug.println("InsertTag: screenManager is null");

}

if (parameterRef != null) directInclude = parameterRef.isDirect();

return SKIP_BODY;

}

public int doEndTag() throws JspTagException {

try {

if (directInclude && parameterRef != null) {

pageContext.getOut().print(parameterRef.getValue());

} else if (parameterRef != null) {

if (parameterRef.getValue() != null) pageContext.getRequest().getRequestDispatcher(parameterRef.getValue()).include(pageContext.getRequest(), pageContext.getResponse());

}

} catch (Exception ex) {

Debug.println("InsertTag:doEndTag caught: " + ex);

}

return EVAL_PAGE;

}

}

<%-- page errorPage="errorpage.jsp" --%>

<%@ taglib uri="/tlds/taglib.tld" prefix="j2ee" %>

<html>

<head>

<title>

<j2ee:insert parameter="HtmlTitle" />

</title>

</head>

<body bgcolor="white">

<j2ee:insert parameter="HtmlBanner" />

<j2ee:insert parameter="HtmlTopIndex" />

<table height="85%" width="100%" cellspacing="0" border="0">

<tr>

<td valign="top">

<j2ee:insert parameter="HtmlBody" />

</td>

</tr>

<tr>

<td valign="bottom">

<j2ee:insert parameter="HtmlPetFooter" />

</td>

</tr>

<tr>

<td valign="bottom">

<j2ee:insert parameter="HtmlFooter" />

</td>

</tr>

</table>

</body>

</html>

slavkoj at 2007-7-1 21:16:01 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

It seems like there is no problem with this code. If I pre-compile the template.jsp with the jspc compiler it works o.k. There error is produced only if compiled at runtime and is either a problem with my weblogic server configuration of a bug with weblogic 5.1sp10 server.

Thanks for everyones help.

Slavko

slavkoj at 2007-7-1 21:16:01 > top of Java-index,Other Topics,Patterns & OO Design...