I might be missing the scope of everything, but just on initial glance:
ServletResponse response = (ServletResponse)
externalContext.getResponse();
ServletRequest request = (ServletRequest) externalContext.getRequest();
Locale locale = viewToRender.getLocale();
response.setLocale(locale);
Config.set(request,
Config.FMT_LOCALE,
facesContext.getViewRoot().getLocale());
externalContext.dispatch(viewId);
externalContext.setResponse(response);
I don't know that I would do a dispatch here-- what you need to do is buffer
the response from the JSP, thereby populating the UIViewRoot.
Because of race conditions that existed in JSF 1.0/1.1, (hans bergsten's onjava
article), rendering happens in two passes-- tree creation, then rendering.
I'm not sure that simply calling externalContext.dispatch(viewId) will capture
the response unless there's something sneaky happening between the first and
last line of the snippet.
Dennis Byrne wrote:
http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java?view=markup
<http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java?view=markup>
On 1/8/07, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>*
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
Where's your ViewHandler code for 1.2?
Hi devs,
I have been spending some time trying to implement
org.apache.myfaces.application.jsp.JspViewHandlerImpl, which is
the myfaces implementation for the ViewHandler. As you might know,
now the viewhandler is the responsible of invoking the renderers
(invoking UIVIewRoot.encodeAll). I am having some problems to
write the response into the page (I can write it to the console
though, as the current code in the SVN repo is doing). Any help or
suggestions will be appreciated!
The code to replace the state part of the response is not
implemented yet. I was just trying to output the code created by
the renderers into the page. I have checked in a test webapp that
can be used to test myfaces 1.2. Of course, now you will get a
blank page with only the html and body tags, but nothing from
within the f:view tags. The view is generated correctly in the
server, as you can see in the output. To test, I am deploying that
webapp in a tomcat 6 instance.
Help! This is an important step for the implementation :-)
Cheers,
Bruno
P.S. The implementation can be found here:
https://svn.apache.org/repos/asf/myfaces/current12
<https://svn.apache.org/repos/asf/myfaces/current12>