Craig:
Please excuse my ignorance on this, but there should be a way around
this problem. These two lines of code appear to be the main problem
preventing people from using struts on VAJ3.5.3.
If I try this code(adapted from Kyle Brown's article:
http://www7.software.ibm.com/vad.nsf/Data/Document2558?OpenDocument&SubM
ast=1 ):
//inside FormTag.doEndTag()
Object o1 = pageContext.findAttribute(Constants.BEAN_KEY);
//o1 is equal to
com.ibm.struts.article.example.base.EmployeeForm@643f
Object o2 = pageContext.getRequest().getAttribute(Constants.BEAN_KEY);
//o2 is equal to
com.ibm.struts.article.example.base.EmployeeForm@643f
pageContext.getRequest().removeAttribute(Constants.BEAN_KEY);
pageContext.getRequest().removeAttribute(Constants.FORM_KEY);
o1 = pageContext.findAttribute(Constants.BEAN_KEY);
//o1 is now null
o2 = pageContext.getRequest().getAttribute(Constants.BEAN_KEY);
//o2 is now null
Are these not in-sync? Or do I need to look somewhere else? If they
are not in-sync would this make both the Request and PageContext
in-sync?
pageContext.getRequest().removeAttribute(Constants.BEAN_KEY);
pageContext.getRequest().removeAttribute(Constants.FORM_KEY);
pageContext.removeAttribute(Constants.BEAN_KEY);
pageContext.removeAttribute(Constants.FORM_KEY);
Again, sorry to keep bringing this up, but it would be great to have the
1.0 release of struts work with VAJ3.5.3 and my lack of experience with
this code is putting me at a big disadvantage on how to resolve this.
David Janovy
-----Original Message-----
From: Craig R. McClanahan
On Wed, 13 Jun 2001, David Janovy wrote:
> Craig:
>
> What's wrong with changing the offending lines to:
>
> pageContext.getRequest().removeAttribute(Constants.BEAN_KEY);
> pageContext.getRequest().removeAttribute(Constants.FORM_KEY);
>
> from:
>
> pageContext.removeAttribute(Constants.BEAN_KEY,
> PageContext.REQUEST_SCOPE);
> pageContext.removeAttribute(Constants.FORM_KEY,
> PageContext.REQUEST_SCOPE);
>
> Does this not remove the attributes correctly?
>
That would remove them from the request correctly, but the problem is
that
the page context would now be out of synchronization with the request
(i.e. these attributes would still be visible via
pageContext.findAttribute()). Custom tags should do all of their
changes
via the page context, because the generated code in the servlet will
synchronize after the tag completes as outlined in the JSP spec.
> Thanks for all you work.
> David Janovy
>
Craig