doAfterBody() is not called

I

iindia

The Same set of code works fine with WebSphere 4.7 (J2EE 1.2 and JSP
1.1). Meaning doAfterBody() is called properly. but when I try using
the same piece of code with WebSphere 5.1 (J2EE 1.3 and JSP1.2)
doAfterBody() not called. I need some help on this ASAP. I thank you
all in advance!


This is my tld :

<tag>
<name>attribute</name>
<tag-class>com.xxx.yyy.GenericTag</tag-class>
<body-content>JSP</body-content>

<attribute>
<name>attrib</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

And this is the part of my JSP where I am calling this tag:

<display:control name="ActFlg" elementName="ActFlg">[^<repeat:attribute
attrib="index"/>$]

And this is the part of the TagSupport :

public class GenericTag extends BodyTagSupport
{
private String attrib;

public void setAttrib(String attrib)
{
this.attrib = attrib;
}

public int doStartTag() throws JspException
{
return super.doStartTag();
}

public int doAfterBody()
{
-do something here
}
return(SKIP_BODY);
}
 
I

iindia

Thanks John! I tried <repeat:attribute attrib="index">
</repeat:attribute> instead of <repeat:attribute attrib="index"/> and
it works fine.
Thanks again!
-RK
John said:
The Same set of code works fine with WebSphere 4.7 (J2EE 1.2 and JSP
1.1). Meaning doAfterBody() is called properly. but when I try using
the same piece of code with WebSphere 5.1 (J2EE 1.3 and JSP1.2)
doAfterBody() not called. I need some help on this ASAP. I thank you
all in advance!
[...]

And this is the part of my JSP where I am calling this tag:
[...]

<repeat:attribute attrib="index"/>

The custom action invocation presented has no body (i.e. it is empty).
In this situation JSP 1.1 and JSP 1.2 both specify that doAfterBody() is
not invoked (see sections 5.4.4 (JSP 1.1) and 10.1.2.4 (JSP 1.2) of the
respective specifications). If WebSphere 4.7 did differently then it
 
I

iindia

Thanks John! I tried <repeat:attribute attrib="index">
</repeat:attribute> instead of <repeat:attribute attrib="index"/> and
it works fine.
Thanks again!
-RK
John said:
The Same set of code works fine with WebSphere 4.7 (J2EE 1.2 and JSP
1.1). Meaning doAfterBody() is called properly. but when I try using
the same piece of code with WebSphere 5.1 (J2EE 1.3 and JSP1.2)
doAfterBody() not called. I need some help on this ASAP. I thank you
all in advance!
[...]

And this is the part of my JSP where I am calling this tag:
[...]

<repeat:attribute attrib="index"/>

The custom action invocation presented has no body (i.e. it is empty).
In this situation JSP 1.1 and JSP 1.2 both specify that doAfterBody() is
not invoked (see sections 5.4.4 (JSP 1.1) and 10.1.2.4 (JSP 1.2) of the
respective specifications). If WebSphere 4.7 did differently then it
 
J

John C. Bollinger

Thanks John! I tried <repeat:attribute attrib="index">
</repeat:attribute> instead of <repeat:attribute attrib="index"/> and
it works fine.
Thanks again!

Since you're so appreciative, I'll throw in that you have created a bug
waiting to happen. If a future maintainer of the JSP should happen to
remove the whitespace between the start and end tags, then the page will
break again. It's not even so unlikely that a maintainer might change
it back to the way it started. The tag handler that supports your
custom action is not written so as to provide the desired behavior when
the action is empty, and since that is apparently a desirable mode of
use, it is probably best to fix the tag handler instead of working
around the bug.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,113
Latest member
Vinay KumarNevatia
Top