B
Bruce Atherton
I'm having a problem porting an application from Weblogic 5.1 to
Oracle 9.04. It has custom tags that have optional parameters. The
trouble is that it appears that the web app is reusing the tag handler
classes.
The current code looks something like this:
public class MyTag extends TagSupport {
private String optional = "not set";
public MyTag() {
super();
}
public void setOptional(String optional) {
this.optional = optional;
}
public int doStartTag() throws JspTagException {
pageContext.getOut().print(optional);
return SKIP_BODY;
}
}
The trouble is that sometimes, in JSPs that don't define the
"optional" attribute, the output reflects the value from a previous
instantiation of the tag. Not every time, but occasionally.
It looks likely that this is happening because the app server is doing
some caching. So I have two questions:
1. Specifically, does anyone know how to turn this behaviour off in
Oracle App Server 9.04 (standalone, not with the webcache package).
2. More generally, what is the correct way to instantiate default
values for optional attributes. Does the spec require that the
release() method reset all optional values to their default values? If
so, what happens when there are two tags on the same page, one with
optional and one not. Or should it be reset at the end of doEndTag().
If so, what happens if an app server tries to reuse the same tag
without calling the set methods, because it thinks they are the same
(can they do that?).
Any information appreciated. Thanks.
Oracle 9.04. It has custom tags that have optional parameters. The
trouble is that it appears that the web app is reusing the tag handler
classes.
The current code looks something like this:
public class MyTag extends TagSupport {
private String optional = "not set";
public MyTag() {
super();
}
public void setOptional(String optional) {
this.optional = optional;
}
public int doStartTag() throws JspTagException {
pageContext.getOut().print(optional);
return SKIP_BODY;
}
}
The trouble is that sometimes, in JSPs that don't define the
"optional" attribute, the output reflects the value from a previous
instantiation of the tag. Not every time, but occasionally.
It looks likely that this is happening because the app server is doing
some caching. So I have two questions:
1. Specifically, does anyone know how to turn this behaviour off in
Oracle App Server 9.04 (standalone, not with the webcache package).
2. More generally, what is the correct way to instantiate default
values for optional attributes. Does the spec require that the
release() method reset all optional values to their default values? If
so, what happens when there are two tags on the same page, one with
optional and one not. Or should it be reset at the end of doEndTag().
If so, what happens if an app server tries to reuse the same tag
without calling the set methods, because it thinks they are the same
(can they do that?).
Any information appreciated. Thanks.