[
https://issues.apache.org/jira/browse/MYFACES-2468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795078#action_12795078
]
Jakob Korherr commented on MYFACES-2468:
----------------------------------------
Hi Mark!
I did a lot of tests and I found out that adding a <view-handler> in
faces-config.xml is not the problem. MyFaces does register the view handler
com.sun.facelets.FaceletViewHandler if you tell it to!!
The problem is that com.sun.facelets.FaceletViewHandler uses its parent
ViewHandler in many cases. On JSF 1.2 the parent handler is JspViewHandlerImpl
and on JSF 2.0 it is ViewHandlerImpl, which behaves differently in many cases.
Besides that JSF 2.0 uses the class ViewDeclarationLanguage to process the view
and com.sun.facelets.FaceletViewHandler, of course, does not provide an
implementation of ViewDeclarationLanguage. So
com.sun.facelets.FaceletViewHandler uses the VDL of his parent
(ViewHandlerImpl), which is in our case JspViewDeclarationLanguage, because we
set javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER to true. This leads to an
infinite loop when trying to render a facelet view.
So we have to provide a ViewDeclarationLanguage for facelets-1. I created a
very simple one, wrote a factory for it and registered it in faces-config.xml
with
<factory>
<view-declaration-language-factory>at.jakobkorherr.myfaces.test.Facelets1ViewDeclarationLanguageFactory</view-declaration-language-factory>
</factory>
I'll attach both files to this issue, but keep in mind that they were developed
quick and dirty and just to get facelets-1 running.
Then there was only one problem left: MyFaces used .jsp to find my facelets in
the file system. This problem can be solved by adding
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
in web.xml.
With these »workarounds« you can run facelets-1 on MyFaces 2.0. However, a lot
of new features will not function properly.
On my opinion it should not be anyone's target to get facelets-1 code running
on JSF 2.0, because then you are not able to use most of the new JSF 2.0
features. This means you could also use JSF 1.2. Besides that most features of
facelets-1 should be easy to migrate to facelets-2, I think.
Furthermore I think that all those taglibs will soon be available for JSF 2.0
also, for example RichFaces 4.0.0. It is just a matter of time, I guess.
> MyFaces needs to support adding a <view-handler> in faces-config.xml
> --------------------------------------------------------------------
>
> Key: MYFACES-2468
> URL: https://issues.apache.org/jira/browse/MYFACES-2468
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 2.0.0-alpha
> Reporter: Mark Struberg
> Priority: Critical
> Attachments: Facelets1ViewDeclarationLanguage.java,
> Facelets1ViewDeclarationLanguageFactory.java
>
>
> The JSF-2 spec defines the <view-handler> tag to enable alternate VDLs via
> faces-config.xml.
> Since there is almost no component library out there which works with the
> built-in facelets-2 VDL, this is a showstopper for a lot scenarios:
> The way I need to use it (tried running RichFaces-3.3.3, Trinidad and
> PrimeFaces-2.0.CR1) :
> in web.xml:
> <context-param>
> <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
> <param-value>true</param-value>
> </context-param>
> and in faces-config.xml:
> <application>
> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
> </application>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.