Hi All,
I was trying to use this library on the resin servlet
container and I ran into a good deal of problems due to
most of the tags trying to call release() in the
doEndTag methods and trying to manage the tag
attributes in way that normaly should not be done
according to the taglib specifications.
Basicly the first problem I ran into was when you had
multiple <vhl:column/> tags under a root as in:
<vlh:row bean="player">
<vlh:column title="playerid"
property="id" sortable="desc" />
<vlh:column title="First"
property="firstName" sortable="desc" />
in the current cvs head the columnTag.doEndTag() method
is calling release(), which eventually sets the parent
tag to null way up in its parent class tree. this
causes a problem in resin as it pools and reuses the
tags as an optimization as follows (generated code):
if (_jsp_DefaultColumnTag_4 == null) {
_jsp_DefaultColumnTag_4 = new
net.mlw.vlh.web.tag.DefaultColumnTag();
_jsp_DefaultColumnTag_4.setPageContext(pageContext);
_jsp_DefaultColumnTag_4.setParent((javax.servlet.jsp.tagext.Tag)
_jsp_DefaultRowTag_3);
_jsp_DefaultColumnTag_4.setSortable("desc");
}
_jsp_DefaultColumnTag_4.setTitle("playerid");
_jsp_DefaultColumnTag_4.setProperty("id");
int _jspEval16 =
_jsp_DefaultColumnTag_4.doStartTag();
_jsp_DefaultColumnTag_4.setBodyContent((javax.servlet.jsp.tagext.BodyContent)
null);
_jsp_DefaultColumnTag_4.doEndTag();
out.write(_jsp_string13, 0,
_jsp_string13.length);
_jsp_DefaultColumnTag_4.setTitle("First");
_jsp_DefaultColumnTag_4.setProperty("firstName");
int _jspEval20 =
_jsp_DefaultColumnTag_4.doStartTag();
_jsp_DefaultColumnTag_4.setBodyContent((javax.servlet.jsp.tagext.BodyContent)
null);
_jsp_DefaultColumnTag_4.doEndTag();
out.write(_jsp_string13, 0,
_jsp_string13.length);
once the second doEndTag was run in this code the
parent was already set to null by the release() call in
the first doEndTag call causing a NullPointerException.
To resolve this issue I have gone thru all the tags
and removed all the explicit release() calls and left
it to the servlet container to make these calls as it
should be.
My next issue I ran into was in the improper changing
of attributes that are supposed to be handled directly
via the server to facilitate scenarios such as the
aforementioned tag pooling behavior. This error first
showed itself in the AddParamTag.onStartTag method
which was trying to reuse the value member that was
dynamicly generated from the property on a previous
call of the tag. Before I had made my first change to
remove the explicit release() calls the properties of
the tags were being reset after each doEndTag call
which prevented this behaviour but unfortunatly the
method of doing so wasn't up to the spec, and had I
left this behavior intact it would have rendered some
of resin's optimization techniques broken. If you look
at the generated code sample above you will see that
the sort order is only set in the initial creation and
not reset each tag the time is reused as there is no
need. Given this behavior I have removed all of the
explicit lifecycle managment of the container managed
properties altogether. As for unmanaged properties
such as some of the maps and the TableInfo I have moved
the initialization to the doStartTag methods of the
appropriate classes rather than have them blindly reset
everything at the the end of every tag.
After those changes were done, most of the samples were
all working correctly except for two. I had an issue
with the examples-multiple.jsp where the root tag would
be placing the list in the page scope and the
vhl:retrieve tag was putting the list in the session
scope. the result of this was the jstl ${list}
expression was still returning the ValueList from the
first tag even inside the middle of the second tag. To
resolve this I changed the vhl:retrieve tag to put the
list on the same pageScope as the parent root tag had
done just beforehand. I would imagine the correct way
to handle this would be to arrange for the variable to
disapear from all the scopes altogether at the end of
the root tag but I'm not quite sure what facility
provides this ability.
Lastly, in example-arrays.jsp, the selectbox wasnt
putting the right filter in the url so I changed the
param name and value it was using, all seems fine now.
attached is a rather large patch with all the changes
I've described above, I verified that all the example
pages work both in resin and in jetty's jsp
implemention and that the test suite still passes as
many tests as it did before i started
patchset for above changes