Ref: Re: [Opensource] Really strange bug when using Expresso in Tomcat 4.1

Raul DAVIDOVICH R.DAVIDOVICH at caconcology.com
Tue Sep 30 07:42:02 PDT 2003


Michael,

I found it!!

in JSP 1.2(tomcat 4.1) the default behaviour for custom tags is to reuse
them, which improves performance, whereas in JSP 1.1 (tomcat 4.0) it
constructs a new object each time the tag is called.

According to the guidelines, all the private invocation-specific state
should be in the doStartTag() method rather than in the constructor, and
AttributeTag has no doStartTag() method, therefore it doesn't get reset.

Simply by adding the following lines to AttributeTag.java the problem was
gone:

...
/**
* Standard doStartTag.
*
* @return  int
* @throws  javax.servlet.jsp.JspTagException
*/
public int doStartTag() throws JspTagException {
   return EVAL_BODY_INCLUDE;
}
...



Here are some docs about this:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html

http://www.onjava.com/pub/a/onjava/2001/11/07/jsp12.html

http://jakarta.apache.org/taglibs/guidelines.html


I checked and this method is missing too in the following tags, but I don't
know wether or not it's neccesary for them:

Back
ContentTag
DBDescription
LabelTag
Login
MessageUtil
UserName
ExpressoTagSupport
ExpressoBodyTagSupport





Thank you very much for your help!


Best regards,

Raul Davidovich


>>At 06:57 AM 9/18/2003, you wrote:
>>>I found out a very strange behaviour when running expresso on Tomcat
4.1,
>>>which doesn't come up in tomcat 4.0.


>>Hi Raul!

>>What you're hitting is a tag reuse problem.  The controller element being
>>used is still reflecting the initial one even though through the reset of
>>the tags before use in the next use of the tag.

>>I thought this was fixed for 5.3, and POSSIBLY later versions of 5.0.X
>>[maybe >.0.3??]  but I can't be sure.  I just remember coming across this
>>and a fix posted by somebody on the list.

>>What's your version you're encountering this.  We'll have to figure out
>>what's not getting reset between instance uses.

>>                                                                 -Mike




>The symptom is OutputTags in JSP don't get refreshed when the transition
>leads to the same page with updated outputs.
>
>I've tracked down the problem up to the level of AttributeTag. What
happens
>here is that because of some strange reason, the variable "oneElement" in
>the AttirbuteTag object always points to the output object created the
>first time the page was built, and it doesn't get updated the following
>times, while all other references to this output object point now to the
>new one (myOutput in MYController, and oneOutput in OutputTag).
>
>So for example we have page a.jsp, which shows the output of the state
>promptAState from MyController.
>This page has an "again" button which will lead to the AState of
>MyController, and this state will give it's results again to promptAState,
>who will show them in an output object, and prompt for a new value and
>"again" or "ok".
>
>Let's say that the first time, the output was "123", and the second time
it
>was "456". In tomcat 4.0 this works fine, but in tomcat 4.1, it will still
>show "123", no matter how many times I press "again". (I insist that the
>new output object is created and filled up with the right values, and
>OutputTag points to the right object)
>
>
>Any clues?
>
>
>Best regards
>
>
>Raul Davidovich
>
>
>
>
>_______________________________________________
>Opensource mailing list
>Opensource at jcorporate.com
>http://mail.jcorporate.com/mailman/listinfo/opensource
>Archives: http://mail.jcorporate.com/pipermail/opensource/


_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/





More information about the Opensource mailing list