From: JS Portal Support [EMAIL PROTECTED]
Gary,
Thank you for your help. Some things are not totally clear to me though, so
excuse my ignorance in these matters. When you say:
The shale-dialog does this sort of thing [2]
Do you mean it already does it in some way like:
No, I meant that shale-dialog has a custom navigation handler.
Sorry, I was being lazy in my response.
dialog name=go_contactus start=exit
end name=exit viewId=/#{sessionVars.locale}/contactus.jsf
redirect=true/
/dialog
Which I tried and it doesn't recognize the the EL and just redirects to the
viewed as a string. The description with your link [3] seems to describe
exactly what I need, but when implemented, it doesn't behave any different
from when I don't use these definitions.
So I guess my question is, do I go and extend
org/apache/myfaces/application/NavigationHandlerImpl.java and build a way to
recognize the EL in my viewId (how would be the next question) or is it a
matter of configuring my faces-config.xml to use the correct handlers that
can already do this?
Extending the myfaces handler might work but most of the methods are private.
It looks like the getNavigationCase is public in the myfaces handler for good
reason.
The entry in the faces-config is need to register your custom handler.
Consider the following snippet:
public void handleNavigation(FacesContext context, String fromAction,
String outcome) {
...
...
NavigationCase navigationCase = getNavigationCase(facesContext, fromAction,
outcome);
if (isEL(navigationCase.getToViewId())) {
... forwards only ...
ValueBinding vb =
context.getApplication().createValueBinding(navigationCase.getToViewId());
String newViewId = (String) vb.getValue(context);
UIViewRoot viewRoot = null;
viewRoot = viewHandler.createView(facesContext, newViewId);
facesContext.setViewRoot(viewRoot);
facesContext.renderResponse();
} else {
original.handleNavigation(context, ..)
}
Thank you for your patience with my coming to grips with the issues at hand,
Joost
Gary
-Original Message-
From: Gary VanMatre [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 12, 2007 2:30 AM
To: user@shale.apache.org
Subject: Re: Alternate ViewController
From: JS Portal Support
Hi,
Though this primarily is a jsf question, I place it here since it might
involve the Clay viewhandler.
I wish to implement a viewhandler that can understand the following
navigation rule, and followed the steps as described in [1]
*
go_contactus
/#{sessionVars.locale}/contactus.jsf
I extended the org.apache.shale.clay.faces.ClayViewHandler and just added
the getActionURL(FacesContext context, String viewId). Unfortunately it is
not working. The page just reloads itself and that's all.
Is there already a system in place that does this as it seems to me a
usefull feature. If not, what am I doing wrong, and should I be extending
the ClayViewHandler or the MyFaces ViewHandler?
You are not using the best extension point. The navigation handler is the
place I'd try adding this extension [1]. The shale-dialog does this sort of
thing [2]. Like the other JSF extension points, you will want to decorate
the original that will be passed via the custom navigation handler's
constructor. The custom navigation handler gets registered in the faces
config [3].
Gary
[1]
http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apach
e/myfaces/application/NavigationHandlerImpl.java?view=markup
[2]
http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog/src/main/jav
a/org/apache/shale/dialog/faces/DialogNavigationHandler.java?view=markup
[3]
http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog/src/main/res
ources/META-INF/faces-config.xml?view=markup
Thank you,
Joost Schouten
Dasstraat 21
2623CB Delft
the Netherlands
[1]
http://typo.ars-subtilior.com/articles/2007/01/24/how-to-make-jsf-navigation
-rules-more-dynamic