myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek (JIRA)" <>
Subject [jira] Commented: (MYFACES-348) JSF tags do not use the pageContext for the tag for output
Date Fri, 19 Aug 2005 12:45:00 GMT
    [ ] 

Martin Marinschek commented on MYFACES-348:

Care to see what the RI for JSF 1.2 is doing in this case?

if the fixes are similar, we will be patching right away, if not, we will need to wait and
implement the JSF 1.2 way of doing things to stay compatible...



> JSF tags do not use the pageContext for the tag for output
> ----------------------------------------------------------
>          Key: MYFACES-348
>          URL:
>      Project: MyFaces
>         Type: Bug
>   Components: JSF 1.1
>     Versions: 1.0.9 beta
>  Environment: Windows 2000, JBoss and Weblogic
>     Reporter: Dan Zehme

> When the JSF tags write to the output stream, they get the ResponseWriter from the FacesContext.
 This ResponseWriter is set up using pageContext of the first tag encountered during the processing
of a request.  If JSF controls are used with JSP pages that are included, the result is that
the JSF output often appears before the JSP output that the JSF output should have been mixed
with. This is because the included pages have a new PageContext and therefore the wrong JspWriter
is used.  This problem is described in Hans Bergsten's book "Java Server Faces" on pages 218-219.
 This is also the reason for the <f:verbatim> tag.
> This problem can be eliminated and the use of the <f:verbatim> tag removed if the
UIComponentTag.doStart/doEnd would push/pop ResponseWriters based on changes to the pageContext.
 More explicitly:
> add to  _PageContextOutWriter:
> public PageContext getPageContext() { return _pageContext }
> in UIComponentTag, add:
> private ResponseWriter _pushedWriter = false;
> in UIComponentTag.setupResponseWriter() before null check add:
> if (_writer instanceof _PageContextOutWriter && ((_PageContextOutWriter)_writer).getPageContext()
!= pageContext) {
>   // PageContext has changed; push the Writer
>   _pushedWriter = _writer;
>   _writer = null;
> }
> at start of UIComponentTag.doEndTag() add:
> if (_pushedWriter != null) {
>   // Restore the previous writer
>   _writer = _pushedWriter
>   _pushedWriter = null;
>   FacesContext facesContext = getFacesContext();
>   facesContext.setResponseWriter(_writer);
> }

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message