Tim Moore wrote:
[...] I agree that the current behavior of release should not change. There are important uses for long-term state that we shouldn't throw away just because of some confusion.
Right.
But what do you think about the idea of adding a new method? My thinking is that if there were a reset method where people could reset invocation-local state, then it would be easier for people to understand the correct purpose of release in contrast. I know there are perfectly good ways to reset now, so this change would be more for psychological reasons than technical ones. You have to admit, though, the fact that this misunderstanding is so common does say something about the clarity of the API. I made this mistake initially, and I believe many of the Jakarta tags did as well.
Yes, the whole reuse things was pretty much unspecified in JSP 1.1. When we tried to clarify it in JSP 1.2, we discussed adding a reset() method at length (the reuse discussions are by far the most intense discussions in the JSP EG ;-) but in the end decided to keep the API backwards compatible and bolt reuse on top of it (with the various rules for when release() can be called, only reuse for the same attribute set, etc.). In hindsight, I think it was a mistake, but that boat has sailed. See below.
I also know that adding methods to an interface can be problematic for backwards compatibility reasons, but if a noop implementation is added to TagSupport, that would handle 90% of the problem. What do you think?
That's the main reason that we decided to not add a method in JSP 1.2, and the same applies to JSP 2.0. Even though you can minimize the problem by adding a noop in TagSupport, you're still not covering 100% of the cases. Another reason for not doing this in JSP 2.0 is that JSP 2.0 introduces a new tag handler API: SimpleTag. This API has a much simpler lifecycle, basically just attribute setters and one doTag() method that, coupled with the new JspFragment API, handles iterations and accessing the body evaluation all in one place. To make things even easier, these tag handlers can _not_ be reused at all. Benchmarks with modern JVMs show that the gain from reuse is not worth all the trouble. So, for new tags we recommend using the SimpleTag API which takes care of the problem by forbidding reuse. Hans -- Hans Bergsten <[EMAIL PROTECTED]> Gefion Software <http://www.gefionsoftware.com/> Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0 Details at <http://TheJSPBook.com/> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>