Using value binding expression for to-view-id

hi;
is it possible to use a value binding expression in the <to-view-id> element?
if not, is there a logical reason for this?
thanks

Shrek-2:
Are we there yet?No
Are we there yet?No
Are we there yet?Yes
Really?
NO
Seriously, the default navigation handler does not allow to use EL for the to-view-id, but you can obtain the desire behaviour with the custom handler decorator.
This is a code snippet:
     public void handleNavigation(FacesContext fc, String actionMethod, String actionName) {
          _base.handleNavigation(fc, actionMethod, actionName);
          String viewId = fc.getViewRoot().getViewId();
        if ((viewId.indexOf("#{") != -1) &&
                (viewId.indexOf("#{") < viewId.indexOf('}'))) {
             String bviewId = (String)fc.getApplication().createValueBinding(viewId).getValue(fc);
             if (bviewId != null)
                  fc.getViewRoot().setViewId(bviewId);
             else {
                  // you can throw the exception here
     }More about HandlerDecorator:
http://www.jsftutorials.net/jsfNavigation/jsf-login-navigation-redirect.html
http://www.jsftutorials.net/faces-config/navigationDecorator.html
P.S. Note: This feature might broke the separation between the different levels of application from the architectural point of view. Hard-coding the ViewIds inside the java code is not a good idea at all.
Sergey : jsfTutorials.net

Similar Messages

  • Using value binding expressions to set 'required' attribute

    I am trying to use a value binding expression to determine whether the value of various input control's is required or not according to where they are used and not having much luck. I wonder if anyone can shed some light on this...
    The following expression works: <h:inputText id="name" required="#{true}"/> whereas <c:set var="required" value="true" scope="request"/>
    <h:inputText id="name" required="#{required}"/> does not, even though the expression evaluates to true! I have tried numerous variations (requestScope.required, required == true, required ? true : false, etc.) to no avail. Interestingly, #{1 == 1} or binding to a backing bean method works, but as soon as you add a request variable it breaks.
    Am I doing something wrong, is this something that JSF doesn't allow, or just a bug in the RI? Note that I don't want to vary this flag between multiple submissions of the same form, I am just trying to reuse the same JSP include to generate form controls for required and optional data on different forms to avoid a whole lot of cutting any pasting.
    Any pointers gratefully received.
    -- Keith Wilson

    I had something like this happen, and here's what I concluded the problem was. Perhaps your problem is similar.
    In the first non-working example you show a request-scope variable being set in the JSP page, and then use that to set the "required" attribute. But consider what happens when you submit the form. There is no longer any request-scope variable set because we have a new request and we don't go through the JSP page! (Not before validation is checked, anyhow).
    So basically I concluded that the variable had to be in (say) session scope for it to work as you would like.

  • Exception handling within a value-binding expression

    Hi all,
    Forgive me if this question seems odd, but I am a long-time Struts developer, new to JSF.
    In Struts, exception handling was easy because all requests were funnelled through some subclass of Action. Exception handling could effectively be consolidated into one spot by applying the template-method pattern.
    Of course, with JSF, this is not possible because method names in value-binding and action-binding expressions can be chosen arbitrarily. For this reason, I am exploring aspect-oriented (and other) techniques for consolidation JSF exception handling into one spot, but rather than focus too intently on that, it's clear that I first need the ability to forward to an error page when an exception is encountered in a value-binding or action-binding expression.
    For action-binding expressions, ExternalContext.dispatch("<view id>"); seems to work quite well, but I am unable to make the same work when in the context of a value-binding expression. This is probably attributed to the fact that at that point, I am in an entirely different phase of the JSF request processing lifecycle.
    What I'm looking to know is if anyone has a reliable means of forwarding to an error page within the context of a value-binding expression. Better yet, does anyone know a reliable way of forwarding to another view regardless of what phase you are in?
    If it makes a difference (and I think it does) the error page uses JSF as well, and uses the same layout (provided via custom tags courtesy of JSP 2.0 tag files), so some view components would have the same name as the page which encountered the error. This seems to get in the way of me simply defining the error page for a 500 in my web deployment descriptor.
    Thanks in advance to anyone with a working suggestion.
    -Kent

    Let me pose a purely hypothetical use case to demonstrate the problem:
    Imagine a page in an HR app, employeeDetails.jsp, that displays an always-up-to-date combo box which lists employee names and IDs. onChange triggers a form submit with the intention of simply posting back to this page, with various text boxes, etc. below updated to show all information for the selected employee.
    Obviously, with the requirement that the combo box always be up to date, it's clear that the getter invoked by the value-binding expression must access the database (not directly of course, but via a facade, application, then data-access layer). Any unexpected and unchecked exception in this chain would propagate back up to the getter method on the backing bean. I need to, at that point, log the exception (trivial) and forward to a user-friendly error page.
    I suppose I could put some contraint on myself that data access is only performed within ActionEvent handlers, but I'm not sure that's consistent with the JSF model in general, in fact it almost seems Struts-like in that I'd have to invoke some action before loading this form to build the up-to-date list for the combo box, shove it in request scope, where it's then available to the page indicated by the navigation rules. Submission of the form on the page in question would also need to result in rebuilding the up-to-date list. Now we're looking at firther propagation of code. I want to avoid this, so I am looking for a better way.

  • Localized String with params - Value Binding Expression...

    Hi All:
    I see many e.g.s where a command button / or a label's value can be a localized resource string using the generic value binding expression:
    "#{bundleVarName.keyName}"
    what if the resource string has parameters? for e.g.
    button.caption = Click Me for {0}
    Can we assign a value binding expression with params for button captions etc.
    Please help - I am a newbie in JSF,,,
    regards
    -Somesh

    JSF developers have forgotten about this :)
    Use other tools for displaying such messages (f. e. JSTL) where you need to have parametrized messaged.
    But mostly, non-parameterized JSF will be enough.

  • Faces config exception - Can't get value from value binding expression:

    the menuItem_Department shown property takes value from userRight's session bean object userDetail.
    class UserRights{
        public boolean mDept = false;
        public boolean loggedIn = false;
        public boolean admin = false;
       //accessors
    }now, the shown property picks correct value for #{userDetail.admin} but gives erros on this. any idea how to get around this exception:
    Managedbean menuItem_Department could not be created Can't get value from value binding expression: '#{userDetail.mDept}'.
    javax.faces.FacesException: Can't get value from value binding expression: '#{userDetail.mDept}'     at com.sun.faces.config.ManagedBeanFactory.evaluateValueBindingGet(ManagedBeanFactory.java:903)
         at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:547)
         at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:233)
         at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)
    .. stack tracepointers appreciated.
    reagrds
    Rabs

    well, i figured out the problem so thought to share with all aswell.
    all i changed was the name of the variable from mDept to dept.
    java beans has its own set of rules and naming conventions which i have not read much about but this problem had to do sumthing with that!
    just changing the name simply works fine!

  • I have been using final cut express for years and now want to switch to final cut studio 3. do I have to remove final cut express before installing final cut studio 3 or can I have them both installed at the same time on one computer?

    I am using a macpro 12 core computer
    I have been using final cut express for years and now want to switch to final cut studio 3. do I have to remove final cut express before installing final cut studio 3 or can I have them both installed at the same time on one computer?

    You can have them both on the same computer as I and many others have done for years.
    Just go ahead and install FCS 3 normally.
    There will be absolutely no problems.

  • Using Final Cut Express for video editing without attaching external device

    Hello,
    I am a newbie to Final Cut Express as well as Mac's in general. I am wanting to use Final Cut Express for video editing of files, but without an attached camera. Is there any way to have Final Cut Express startup without having it prompt for an external A/V device? I just want to do some basic editing and use the chroma key feature. Can anyone help?
    Greatly Appreciated,
    Knight2000
    iMAC   Mac OS X (10.4.9)  

    Hi Zak,
    Unfortunately, I've tried that and I get into an issue that was addressed in this posting: http://discussions.apple.com/thread.jspa?threadID=836595&tstart=120 where FCE will show the splash screen and then the program doesn't start. I then have to delete FCE preferences and then I will get the Easy Setup dialog box prompt me again for choosing the external device.
    I am looking for a way to use FCE for video editing of files that I already have on my computer that I created using iClone software and is in .avi, or .mp4 format. I get FCE to work one time without the external device actually being attached, but then when restarting the program I get the dialog box asking for the external device and if it's not there, the program just closes, and to get it to work again, I have to delete the preference files and go through the process all over again which is time consuming especially when this is at work. If FCE is not the right program, can anyone suggest a good video editing program that doesn't require an external device and is as good or better than FCE?
    Thanks again for your help and support,
    Knight2000
    iMAC   Mac OS X (10.4.9)  

  • I now have internet thru AT&T Uverse with their wireless router.....do I still need to use my Airport Express for my 2 MACS or can I just unplug it?

    I now have internet thru AT&T Uverse with their wireless router.....do I still need to use my Airport Express for my 2 MACS or can I just unplug it?

    You can just unplug the express and use the Uverse wireless or ethernet directly to it.

  • HT3728 I do not need another wireless network but want to use the airport express for printer access only.  Can this be done and how?

    I do not need another wireless network but want to use the airport express for printer access only.  Can this be done and how?

    You can configure the AirPort Expess to "Join a wireless network" and enable the Ethernet port so that Ethernet devices will be able to connect.
    In order to print from the iOS devices, you will need to have an application like Printopia installed on your Mac. The Mac must be active when you want to print.
    More details here: Printopia - AirPrint to Any Printer - Print from iPad - Print from iPhone ...
    There is a free trial available for Printopia, so make sure that it will work before you buy the AirPort Express.

  • √using successfully airport express for internet/ when hooking up new airport extreme light glows green, but does NOT appear in devices seen????airport wifi devices

    using sucessfully airport express for internet
    when hooking up new airport extreme light glows green, but does NOT appear in devices sesn in 5.6 airport wifi devices
    wanting to use extreme at base and express in another part of the house

    How is the express getting internet? What modem is it plugged into?
    How is the extreme setup? New extreme cannot be setup with 5.6 utility.. you must use latest 6.3. Which also means you cannot setup from computer using less than Lion .. or you must use iOS with latest utility but it has limited configuration cf the computer version.
    IPv6 is also needed.. turn on local link.

  • Setting bind variable for a view object from the Managed Bean

    Hi,
    i am using JDeveloper 11g, i have to create LOV in the JSF. To show the LOV, it has to populate data using View object and its query parameter need to be sent from the Managed Bean.
    For the View object i want to set the bind variable parameter from the managed bean value. bename is stored in a managed bean (session scope)
    #{beantest.bename}
    But it gives the following exception.
    JBO-29000: Unexpected exception caught:
    org.codehaus.groovy.control.MultipleCompilationErrorsException,msg=startup failed, Script1.groovy: 1: expecting '!',found '{'@ line1, column 2.
    I have followed the link http://kr.forums.oracle.com/forums/thread.jspa?threadID=615474 like Frank wrote on 8.2.2008:
    But steps are not clear.
    How to input the VO bind parameter with Managed bean variable?
    Any Help
    Regards
    Raj
    Edited by: user9928180 on Dec 17, 2008 9:51 AM

    Hi,
    a bind variable in a VO needs to be exposed as an executeWithParams operation in the pageDef file. Just add a new action binding to the pageDef file (context menu) and select the executeWithParams operation on teh VO. Then in the argument field, reference the managed bean property for the value
    Frank

  • Displaying diff dates using PL/SQL expression for 'display only' item ?

    Hi ,
    I am having a display only item -- :P2_FROM_Date . If its Thu,Fri,Sat or Sun I want to set the date as the last Monday's date . If its Mon,Tue or Wed then it should be the present Monday's date .
    E.g: Today is Friday and the last Monday was on 18th .
    So for yesterday , today,tomorrow and Sunday , the date should be displayed as 18-JUN-2012.
    From the coming Monday to Wednesday , the date should of be the coming Monday i.e , 24-JUN-2012
    I tried it doing under 'Source ' of item using PL/SQL expression and PL/SQL function body. Not working
    Can someone help ?
    Thanks & Regards
    Umer

    Nice1 wrote:
    declare
    lv_date number;
    begin
    select to_char(sysdate,'D') into lv_date from dual;
    if lv_date=2 then
    :P2_FROM_DATE := to_char(sysdate-1);
    end if;
    end;I tried this under " PL/SQL function body " in "Source " tab of the item P2_FROM_DATE
    When I run this , nothing is displayed corresponding to the item P2_FROM_DATEExactly as expected. This code will only set a value for <tt>P2_FROM_DATE</tt> when run on Mondays in territories where the first day of the week is Sunday, and when run on Tuesdays where Monday is the first day of of the week:
    SQL> var P2_FROM_DATE varchar2(30)
    SQL> alter session set nls_date_format='Dy DD-MON-YYYY';
    Session altered.
    SQL> select sysdate from dual
    SYSDATE
    Mon 25-JUN-2012
    SQL> alter session set nls_territory='AMERICA';
    Session altered.
    SQL> declare
      2  lv_date number;
      3  begin
      4  select to_char(sysdate,'D') into lv_date from dual;
      5  if lv_date=2 then
      6  :P2_FROM_DATE := to_char(sysdate-1);
      7  end if;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> print p2_from_date
    P2_FROM_DATE
    Sun 24-JUN-2012
    SQL> alter session set nls_territory='UNITED KINGDOM';
    Session altered.
    SQL> exec :p2_from_date := null
    SQL> declare
      2  lv_date number;
      3  begin
      4  select to_char(sysdate,'D') into lv_date from dual;
      5  if lv_date=2 then
      6  :P2_FROM_DATE := to_char(sysdate-1);
      7  end if;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> print p2_from_date
    P2_FROM_DATE
    SQL>Hence the questions about language above.
    >
    I am having a display only item -- :P2_FROM_Date . If its Thu,Fri,Sat or Sun I want to set the date as the last Monday's date . If its Mon,Tue or Wed then it should be the present Monday's date .
    E.g: Today is Friday and the last Monday was on 18th .
    So for yesterday , today,tomorrow and Sunday , the date should be displayed as 18-JUN-2012.
    From the coming Monday to Wednesday , the date should of be the coming Monday i.e , 24-JUN-2012
    >
    The coming Monday is 25-JUN-2012.
    Aren't these rules equivalent to "Monday this week, where Monday is the first day of the week"? In which case the PL/SQL Expression you require is:
    trunc(sysdate, 'iw')For example:
    SQL> with t as (
      2    select date '2012-06-21' + level d from dual connect by level <= 17)
      3  select
      4            d
      5          , trunc(d, 'iw')  monday
      6  from
      7            t;
    D               MONDAY
    Fri 22-JUN-2012 Mon 18-JUN-2012
    Sat 23-JUN-2012 Mon 18-JUN-2012
    Sun 24-JUN-2012 Mon 18-JUN-2012
    Mon 25-JUN-2012 Mon 25-JUN-2012
    Tue 26-JUN-2012 Mon 25-JUN-2012
    Wed 27-JUN-2012 Mon 25-JUN-2012
    Thu 28-JUN-2012 Mon 25-JUN-2012
    Fri 29-JUN-2012 Mon 25-JUN-2012
    Sat 30-JUN-2012 Mon 25-JUN-2012
    Sun 01-JUL-2012 Mon 25-JUN-2012
    Mon 02-JUL-2012 Mon 02-JUL-2012
    Tue 03-JUL-2012 Mon 02-JUL-2012
    Wed 04-JUL-2012 Mon 02-JUL-2012
    Thu 05-JUL-2012 Mon 02-JUL-2012
    Fri 06-JUL-2012 Mon 02-JUL-2012
    Sat 07-JUL-2012 Mon 02-JUL-2012
    Sun 08-JUL-2012 Mon 02-JUL-2012
    17 rows selected.
    SQL> alter session set nls_territory='AMERICA';
    Session altered.
    SQL> alter session set nls_date_format='Dy DD-MON-YYYY';
    Session altered.
    SQL> with t as (
      2    select date '2012-06-21' + level d from dual connect by level &lt;= 17)
      3  select
      4            d
      5          , trunc(d, 'iw')  monday
      6  from
      7            t;
    D               MONDAY
    Fri 22-JUN-2012 Mon 18-JUN-2012
    Sat 23-JUN-2012 Mon 18-JUN-2012
    Sun 24-JUN-2012 Mon 18-JUN-2012
    Mon 25-JUN-2012 Mon 25-JUN-2012
    Tue 26-JUN-2012 Mon 25-JUN-2012
    Wed 27-JUN-2012 Mon 25-JUN-2012
    Thu 28-JUN-2012 Mon 25-JUN-2012
    Fri 29-JUN-2012 Mon 25-JUN-2012
    Sat 30-JUN-2012 Mon 25-JUN-2012
    Sun 01-JUL-2012 Mon 25-JUN-2012
    Mon 02-JUL-2012 Mon 02-JUL-2012
    Tue 03-JUL-2012 Mon 02-JUL-2012
    Wed 04-JUL-2012 Mon 02-JUL-2012
    Thu 05-JUL-2012 Mon 02-JUL-2012
    Fri 06-JUL-2012 Mon 02-JUL-2012
    Sat 07-JUL-2012 Mon 02-JUL-2012
    Sun 08-JUL-2012 Mon 02-JUL-2012
    17 rows selected.Also note that using the item source properties will only set the <tt>P2_FROM_DATE</tt> in the rendered page, not in session state.

  • Using Final Cut Express for Ipod Touch

    I'm using Final Cut Express to bring a group of MP4 videos together into one video - for viewing on an Ipod Touch G2. Any advise on the best settings to use.
    Appreciate and and all help I can get!
    Dean

    So - I don't need to edit it, simply compile a bunch of videos together. The problem I have with iMovie 09 is that I need to see the list of video files by name. iMovie 09 won't present listings of video files by name, only by thumbnail.
    To be honest - I'd rather use iMovie 09 as it seems to compile my files MUCH faster. I have a MacPro 2.33Mhz with 8 GB Ram, and a 24 hour video is taking up to 24 hours to compile.

  • Can a web service be used as the datasource for a View Object?

    Has anyone used a web service as the datasource for a View Object?
    I am trying to do the same thing as "Publishing BC4J Components as a Web Service" example, except I want to recreate the View Objects on the client so that I can iterate through them and display them on a web page.
    I probably have two choices:
    1. Use the web service as the datasource.
    2. Use a file as the datasource with no data and then populate the View Objects from the XML from the Web Service.
    Please advise.
    Thank you.
    Richard Catlin
    SAIC

    You can adapt the examples provided in the BC4J Toy Store demo for how to build a programmatically-populated view object to create a view object that fetches its data from a web service.
    The methods that you need to override are the same for any kind of programmatically-populated view object.

  • Using Solaris 11 Express for a multiprocessor CAD/CAM x86-64 system.

    I'm considering using Solaris 11 Express as the OS for a multiprocessor Computer Aided Design/Computer Aided Manufacturing custom built x86-64 system for my machine shop business. I would like clarification of the license in this situation.
    Would I be allowed to use Solaris 11 for free under the open-source license, or would I have to purchase a commercial license? Would I have to pay for program updates? Does just the Oracle Solaris Premier Subscription for Solaris 11 require payment rather than the actual software as well? Would I be required to purchase an Oracle Solaris Premier Subscription to use Solaris 11 in my situation, or can I purchase the Oracle Solaris Premier Subscription at a later date.
    I have a lot of respect the open-source concept, and I would only use Solaris while keeping it's license intact. So the answers to these questions are very important factors affecting my decision regarding whether or not my company will start to use Solaris.

    I'm afraid you'll have to contact Oracle directly to clarify what applies in your situation.

Maybe you are looking for