Agree. Cosma
2006/6/7, Matthias Wessendorf <[EMAIL PROTECTED]>:
Something like that would be great. not that ugly "do it all in one"-thing On 6/7/06, Andrew Robinson <[EMAIL PROTECTED]> wrote: > Thanks > > https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=179 > > -Andrew > > On 6/7/06, Matthias Wessendorf <[EMAIL PROTECTED]> wrote: > > It is possible to use > > https://javaserverfaces-spec-public.dev.java.net/ > > for enhancements. > > > > > > > > On 6/7/06, Andrew Robinson <[EMAIL PROTECTED]> wrote: > > > I would have to agree. I really dislike the NavigationHandler > > > interface. It is really inflexible. I would love if Sun could fix the > > > specification to expose more of the functionality instead of one black > > > box method. There really needs to be an API to retrieve the result > > > without navigating, or at least some override to be able to modify the > > > view ID before the view handler is called. > > > > > > I think you'd be best to write your own view handler (extend and > > > existing one for ease) and in the create view method, check for > > > parameters there. That way you can do everything you need. > > > NavigationHandler just doesn't have what you need for this > > > functionality. > > > > > > On 6/7/06, Cosma Colanicchia <[EMAIL PROTECTED]> wrote: > > > > The <to-view-id> element is part of the <navigation-case>. But finding > > > > the proper <navigation-case> is exactly the task that handleNavigation > > > > method should perform.. once found one, you can call > > > > navigationCase.getToViewId() to get the information you need. > > > > > > > > The problem is that the NavigationHandler specification does not need > > > > to "return" that object, but to directly process it.. so you don't > > > > have control over the to-view-id string before it gets translated in a > > > > UIViewRoot object. > > > > > > > > I think you have to re-implement the handleNavigation method, copying > > > > the myfaces code and adding your logic *after* it gets the correct > > > > <to-view-id> string but *before* it creates a UIViewRoot and render > > > > it. > > > > > > > > Question for myfaces devs: maybe I'm missing something, but why not > > > > "break" the handleNavigation method in two? handleNavigation could for > > > > example only resolve a <to-view-id> string and pass it to another one > > > > that do the creates the view, set it as the viewroot and invoke > > > > renderResponse().. or encapsulate all the <navigation-case> finding > > > > logic in another method and have the handleNavigation only process the > > > > returned <to-view-id>. This should make life easier for extending > > > > classes. > > > > > > > > > > > > Bye > > > > Cosma > > > > > > > > 2006/6/6, Peter Henderson <[EMAIL PROTECTED]>: > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > > Hash: SHA1 > > > > > > > > > > Jonathan Harley wrote: > > > > > > Cosma Colanicchia wrote: > > > > > >> Reading that wiki post: > > > > > >> > > > > > >> "For these reasons [...] one should consider using a custom > > > > > >> Navigation Handler adding the following capabilities:" > > > > > >> > > > > > >> I've understood that you have to code and plug your custom navigation > > > > > >> handler to inplement this sort of navigation logic. I've never seen > > > > > >> using EL expressions in <to-view-id> elements, anyone know if this is > > > > > >> supported by the standard JSF nav. handler? > > > > > > > > > > > > No, it isn't, but it's very easy to do. See for example > > > > > > http://forum.java.sun.com/thread.jspa?threadID=492721&messageID=2318174 > > > > > > > > > > > > > > > > > > Jon. > > > > > Thanks for that Jon > > > > > > > > > > > > > > > Based on the info in that thread and the linked articles I've knocked up > > > > > my own Navigation handler. > > > > > The trouble is, I dont seem to be able to get the <to-view-id> part of > > > > > the navigation rule in order to fix the parameters. > > > > > > > > > > > > > > > Here is my Navigation handler. > > > > > package com.starjar.facestest; > > > > > > > > > > import javax.faces.application.NavigationHandler; > > > > > import javax.faces.context.FacesContext; > > > > > > > > > > /** > > > > > * Based on > > > > > * http://forum.java.sun.com/thread.jspa?threadID=492721&messageID=2318174 > > > > > * > > > > > * > > > > > * @author peter > > > > > */ > > > > > public class ParameterNavigationHandler extends NavigationHandler { > > > > > > > > > > NavigationHandler _base; > > > > > > > > > > /** Creates a new instance of ParameterNavigationHandler */ > > > > > public ParameterNavigationHandler(NavigationHandler base) { > > > > > super(); > > > > > System.out.println("===IN ParameterNavigationHandler ctor ="); > > > > > this._base = base; > > > > > } > > > > > > > > > > public void handleNavigation(FacesContext fc, String actionMethod, > > > > > String actionName) { > > > > > System.out.println("====IN ParameterNavigationHandler ="); > > > > > > > > > > _base.handleNavigation(fc, actionMethod, actionName); > > > > > > > > > > String viewId = fc.getViewRoot().getViewId(); > > > > > System.out.println("ORIGINAL VIEW " + viewId + > > > > > " actionMethod " + actionMethod + > > > > > " actionName " + actionName ); > > > > > if ((viewId.indexOf("#{") != -1) && > > > > > (viewId.indexOf("#{") < viewId.indexOf('}'))) > > > > > { > > > > > String bviewId = > > > > > (String)fc.getApplication().createValueBinding(viewId).getValue(fc); > > > > > System.out.println("NEW VIEW id " + bviewId ); > > > > > if (bviewId != null) { > > > > > fc.getViewRoot().setViewId(bviewId); > > > > > } else { > > > > > // you can throw the exception here > > > > > } > > > > > } > > > > > } > > > > > } > > > > > > > > > > > > > > > Values of fields > > > > > viewId = /secure/company/list.jsp > > > > > actionMethod = #{quickNewCompanyBean.create} > > > > > actionName = view-company > > > > > > > > > > I was expecting one of these value to be the <to-view-id> > > > > > /secure/company/view.jsp?companyID=#{quickNewCompanyBean.companyID} > > > > > > > > > > > > > > > Im no JSF expert and feel completly out of my depth here. > > > > > > > > > > > > > > > Cheers > > > > > Peter Henderson > > > > > > > > > > > > > > > -----BEGIN PGP SIGNATURE----- > > > > > Version: GnuPG v1.4.2.2 (GNU/Linux) > > > > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > > > > > > > iD8DBQFEhc8HaeMEhGmZg50RAuBVAJ90lVNe5QjNRjOiHw3cAs6a1o2SnACeKgtx > > > > > u8IAWTxZ4JVD/2HjvvtRdtA= > > > > > =gxLN > > > > > -----END PGP SIGNATURE----- > > > > > > > > > > > > > > > > > > -- > > Matthias Wessendorf > > Aechterhoek 18 > > 48282 Emsdetten > > blog: http://jroller.com/page/mwessendorf > > mail: mwessendorf-at-gmail-dot-com > > > -- Matthias Wessendorf Aechterhoek 18 48282 Emsdetten blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com

