Can I extend the ModuleTag class ? ? ?

I want to make a new class which extends ModuleTag class.
I want this in order to do some serverside controls before committing the processes.
For example I want to check data integrity from Tamino database and check whether the record can be deleted or not.
If it can be deleted I want to pass the work to ModuleTag class and it will delete the record.
If the record should not be deleted I will stop the process and dont let the record being deleted.
When I wrote a new class extending the ModuleTag I recieved the following error because of the CheckAncestors method of XBody Tag.
Does this method mean I should not write a new class extending ModuleTag ? ? ? ?

Exception error message: <Missing ModuleTag. If this page used to work in a previous version of X-Application, please refer to the changelog file for more information.>
Stacktrace is:


<javax.servlet.jsp.JspException: Missing ModuleTag. If this page used to work in a previous version of X-Application, please refer to the changelog file for more information.
at com.softwareag.xtools.xapplication.jsptaglib.XBodyTag.checkAnchestor(XBodyTag.java:87)
at com.softwareag.xtools.xapplication.jsptaglib.XBodyTag.doStartTag(XBodyTag.java:65)
at _0002fsearch_0002ejspsearch_jsp_0._jspService(_0002fsearch_0002ejspsearch_jsp_0.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)
>


X-Application Version: 3.1.1
Tamino Version : 3.1.1
Platform : Win2k
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

It should be possible to derived from ModuleTag.

But we didn’t anticipate this case - resulting
in the error message you got.

Please edit XBody.java and replace
private void checkAnchestor() throws JspException {
if (!getClass().equals(ModuleTag.class)) {
if (BodyTagSupport.findAncestorWithClass(this, ModuleTag.class) == null) {
throw new JspException(MISSING_MODULE);
}
}
}

by
private void checkAnchestor() throws JspException {
if (this instanceof ModuleTag) {
if (BodyTagSupport.findAncestorWithClass(this, ModuleTag.class) == null) {
throw new JspException(MISSING_MODULE);
}
}
}

This should solve the problem (for now …)

Michael

Software AG Germany, Darmstadt

Thanks Michael Hartmeier,
But you have probably forgatten to write !
shouldn’t it be like this :

if (!(this instanceof ModuleTag)) {
if (BodyTagSupport.findAncestorWithClass(this, ModuleTag.class) == null) {
throw new JspException(MISSING_MODULE);
}
}

Your’re right, I forgot the “!”.

Sorry, silly mistake.

Michael

Software AG Germany, Darmstadt