Using navigation rule

Is it possible to use navigation rule to render out UIComponent appropriately?

I'm not sure what you mean!!! But the UI Component needs to be on a page which can be reached through a navigation rule.

Similar Messages

  • Alternative of Navigation-Rule.

    Let us say I have a LoginBean java (for login web screen) and a MainBean java (for main web screen). In the JSP file I will call the LoginBean method to launch the screen with components dynamically using the following lines:
    <f:view>
    <h:form id="Login">
    <table height="100%" width="100%" border="0">
    <tr>
    <td align="center" valign="middle">
    <af:panelGroup binding="#{LoginBean.loginPanel}" />
    </td>
    </tr>
    </table>
    </h:form>
    </f:view>
    Right now I am using navigation-rule to move to the main screen reading the MainBean from the main screen JSP file. Can I create an instance of the main screen from the LoginBean? Here is an example of creating an instance:
    main = new MainBean(this, "APPLICATION NAME");
    Any idea?

    The <from-view-id> is optional. Just remove them.
    By the way, I would rather use plain vanilla links (<h:outputLink> or just <a>) for plain navigation. Navigation by POST isn't always a good idea.

  • Multiple Use of Navigation-Rule

    Hi!
    Is it possible to use the navigation rules in the faces-config multiple times or must i create one rule for each link?
    I thought about this way:
    <navigation-rule>
       <from-view-id>/Page1.jsp</from-view-id>
       <from-view-id>/downloads.jsp</from-view-id>
       <navigation-case>
          <from-outcome>login</from-outcome>
          <to-view-id>/Login.jsp</to-view-id>
       </navigation-case>
    </navigation-rule>The Page1.jsp redirects as well as the downloads.jsp to the Login.jsp. Both are in a navigation bar.
    Is there any workaround possible or must i add several navigation rules?

    The <from-view-id> is optional. Just remove them.
    By the way, I would rather use plain vanilla links (<h:outputLink> or just <a>) for plain navigation. Navigation by POST isn't always a good idea.

  • Navigation and Creating  a navigation rule at runtime

    Hi all,
    How can I create a navigation rule at runtime?
    I got all my pages (names and locations) stored in a database table.All my pages are jspx format.
    I don't want to create navigation rules for each page, Instead I want to use the location stored in the database and create a navigation rule to navigate to.
    I tried navigating using ServletRequest :
            ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
            HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
            HttpServletRequest  request = (HttpServletRequest)ectx.getRequest();
            request.getRequestDispatcher("/faces/Titles.jspx").forward(request,response);But it blows after the first call.
    is it possible to create a navigation rule in a Bean or is there another way to call jspx pages from a Bean without loosing the session.
    Can someone help me please.
    thanks in advance,
    Ahmad Esbita

    Ahmad,
    I don't know of any way to programatically create navigation cases at runtime. However, perhaps you could try creating a NavigationHandler decorator. Let's assume you have a function called "getViewIDforAction" that does the database lookup and returns the view ID for a given action code. You could do something like this:
    package my.code;
    import javax.faces.application.NavigationHandler;
    import javax.faces.context.FacesContext;
    public class MyNavigationManager extends NavigationHandler
       NavigationHandler _base;
       public NavigationManager (NavigationHandler base)
          super();
          _base = base;
       public void handleNavigation(FacesContext fc, String actionMethod, String actionName)
          String viewID = getViewIDforAction(actionName);
          if (viewID != null && ! "".equals(viewID))
             fc.getViewRoot().setViewId(viewID);
          else
             _base.handleNavigation(fc, actionMethod, actionName);
    }You'll also need this in faces-config.xml:
    <application>
      <navigation-handler>my.code.MyNavigationManager</navigation-handler>
    ...any other stuff...
    </application>Note: I haven't tested this or anything - just to give you an idea...
    Regards,
    john

  • How can i add a navigation rule at the runtime of JSF?

    Hello,
    how can i add a navigation rule at the runtime of JSF. Maybe i should use the method "addNavigationRule()" in class "FacesConfig", but i do not know, how can i obtain the instance of class "FacesConfig". Can anybody help me?
    Thank you very much!!!

    Just curious: Why whould you want to add navigation Rules at run time. I believe the navigation rules should be set to begin with - "by s/w Architect Design".
    Else you can always use Redirect / Forward.

  • JSF navigation rules sent me to different page, with same URL

    Hello everybody,
    Have a newbie question on JSF, if anyone can help me. I am using JSF for a web application, and i have a small problem.
    If i define a navigation rule, from one page to another, and i am having a button that should send me to another page,
    the browser URL remains the same, although the page content IS correctly changed.
    Thanks,
    Andrei

    You're welcome.
    Though I should have added that the advantage of the redirect after a POST request is that refreshing the request or navigating back and forward by browser history doesn't cause a re-submit of the POST request anymore. This way you avoid duplication of submitted data. This is called POST-redirect-GET pattern. Refreshing the request after a redirect (which is always a GET request) would only cause the redirect being refreshed, not the initiating POST request.
    The disadvantage of a forward is less or more obvious: the URL remains the same and it is not really good for the user experience. If one copypasted the URL in a new window (a new GET request), one wouldn't see the forwarded page, but the originating page. That's why I would recommend to avoid navigation cases and just use the same page to postback the POST request to. For normal page-to-page navigation within a website, I would recommend just using outputlinks and not commandlinks with navigation cases. It's all better for the user experience.

  • Forward to JSP page without using Navigation Model

    How can I forward to a JSP page without using the Navigation Model?

    It's done in the cardemo example in
    ImageMapEventHandler.processAction() Is there a reason
    for it there?Ah ... that makes sense.
    That code in CarDemo was written before there was such a thing as a NavigationHandler, and we didn't have time to update it to the new approach before the EA4 release. That'll be changed before the next one. In the mean time, I'd recommend that you use the navigation rules mechanism where it works for you, because it encourages good separation of business logic and presentation logic that will lead to more maintainable applications.
    Craig

  • Adding custom navigation rules results in strange behavior

    Hello,
    We'd like to add navigation rules to our application. To avoid post-JHeadstart-generation-steps we created an extra faces-config-custom.xml file which contains the navigation rules. When adding this file to the web.xml and run the aplication we encounter strange behavior
    - Errors are shown in duplicate
    - 'Transaction completed' messages are not shown
    Try adding the underneath faces-config-custom.xml to a standard HR demo project and you will get the same behavior.
    (1) What is the reason of this strange behavior?
    (2) How can we add custom navigation rules, without having to do post creation steps?
    Regards Leon
    [faces-config-custom.xml]
    <?xml version="1.0" encoding="windows-1252" ?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config xmlns="http://java.sun.com/JSF/Configuration">
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>BezwaarVerzoeken</from-outcome>
    <to-view-id>/pages/inboeken/BezwaarVerzoeken.jspx</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>LosseOpdrachten</from-outcome>
    <to-view-id>/pages/inboeken/LosseOpdrachten.jspx</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    [Add faces-config-custom.xml to web.xml]
    <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config-custom.xml,...

    Leon,
    When you perform a drag and drop operation, JDeveloper adds the following lines to the faces-config.xml:
    <lifecycle>
    <phase-listener>
    Oracle.adf.controller.faces.lifecycle.ADFPhaselistener
    </phase-listener>
    </lifecycle>
    However, JHeadstart uses its own subclass of ADFPhaselistener, and defines the lifecycle element in JhsCommon-beans.xml. Due to a bug in ADF, ADF does not look for the lifecycle element in other files than faces-config, and adds its own element in faces-config.xml If you remove these lines, everything works fine again.
    To prevent this from happening again, you can move the following entry from JhsCommon-beans.xml to faces-config.xml:
    <lifecycle> <phase-listener>oracle.jheadstart.controller.jsf.lifecycle.JhsADFPhaseListener</phase-listener>
    </lifecycle>
    And then make a custom template for JhsCommon-beans.vm where you remove this entry.
    Steven Davelaar,
    JHeadstart team.

  • Access navigation rules programmatically?

    Hello.
    Is there any way to access the attributes of a navigation rule programmatically?
    In Struts, I was accustomed to getting the URL of a forward that I had set up by doing something like:
    <html:rewrite forward="myForwardName"...>on my JSP page, but I can't seem to find any equivalent of this functionality in JSF.
    Also, I would like to be able to access the navigation rule attributes from Java code, too, particularly the "to-view-id" attribute, which is something I did in Struts with code like:
    String path = mapping.findForward("myForwardName").getPath();I know that this isn't apples-to-apples, and that a global forward in Struts is not set up the same way as a navigation rule in JSF, but I'm hoping that there's some kindly JSF super-genius who can point me in the right direction. :-)
    Thanks!
    --Mike                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thanks, rei_nanto--that did shed a little light on the subject!
    Now, unfortunately, I am not using the Sun reference implementation (we're using the IBM implementation), and so I don't have the ApplicationAssociate class you mentioned.
    I went out and looked at the ApplicationAssociate and NavigationHandlerImpl classes in the RI jars, though, as you suggested, and I can see how it could be done.
    The reason I'm looking for a way to get this information, especially the <to-view-id> information, is because I need to do a popup window from my JSF application page, and I would like not to hard-code the URL of the JSF page I want to appear in the popup.
    Hence, if I could get the path out of <to-view-id> programatically, I wouldn't have to hard-code the path in my popup.
    Any additional thoughts on the matter, given this additional information?
    Thanks!
    --Mike                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem with navigation-rules

    Hello!!!
    I'm using Jboss Jbpm with JSF and I want to navigate to other page when I fill a form and I send the data that I entered. I have declare the navigation-rules but it doesn't work and I don't know why.
    In my faces-config.xml I've added the navigation-rules:
    <managed-bean>
                   <managed-bean-name>usuario</managed-bean-name>
                   <managed-bean-class>com.miApp.UserBean</managed-bean-class>
                   <managed-bean-scope>request</managed-bean-scope>
              </managed-bean>
         <navigation-rule>
                   <from-view-id>/SolicitarAlta.xhtml</from-view-id>
                   <navigation-case>
                        <from-action>#{usuario.registrar}</from-action>
                        <from-outcome>correcto</from-outcome>
                        <to-view-id>/results/correcto.jsp</to-view-id>
                   </navigation-case>
         </navigation-rule>
         The UserBean has the method registrar:
    public String registrar() {
           if(dni==null || nombre==null || apellidos==null || ocupacion==null || mail==null || tlf==null ||
    password==null)      
                return "campos-obligatorios";
           if ((mail.trim().length() < 3) ||       (mail.indexOf("@") == -1))
                          return "mail-incorrecto";
           else if(tlf.length()!=9)     return "telefono-incorrecto";
                else if(dni.length()!=8) {return "dni-incorrecto";}
           return "correcto";
         And with this line:
    <h:commandButton type="submit" value="Enviar" action="#{usuario.registrar}"/>     the method registrar is executed and I know that this method returns the string "correcto" but ... This doesn't redirect me to the page correcto.jsp
    I thought that maybe if SolicitarAlta was an xhtml file the correcto page should be also an .xhtml file. I changed it but it doesn't work.
    Any ideas? Could it be that I have to add something more in the faces-config.xml & web.xml file???
    Thx!

    I found the solution to my problem but I don't really understand why it was not working. My problem was due to the use of command button with a render set to false. I just put them at true and all my navigation rules work!
    If someone know why it was not working, I would be glad to know!

  • Navigation Rule for multiple Links

    Hi,
    I am using Eclipse & JSF.Now my problem is i having multiple links on a single JSF page. Suppose A,B & C.
    Now A calling a page called AA.jsp through a backing bean.
    Simmillarly, B calling a page called BB.jsp through a backing bean.
    Simmillarly, C calling a page called CC.jsp through a backing bean.
    I have defined a navigation rule also for that. But ,what happens is when A calls AA.jsp it gets redirected to CC.jsp.
    I dont know how it is going.
    My faces-config.xml is..
    <navigation-rule>
             <display-name>
             Maintanance1</display-name>
             <from-view-id>
             /Maintanance1.jsp</from-view-id>
             <navigation-case>
                  <to-view-id>
                  /Assign_Case.jsp</to-view-id>
             </navigation-case>
        </navigation-rule>
        <navigation-rule>
             <display-name>
             Assign_Case</display-name>
             <from-view-id>
             /Assign_Case.jsp</from-view-id>
             <navigation-case>
                  <to-view-id>
                  /Maintanance1.jsp</to-view-id>
             </navigation-case>
        </navigation-rule>
        <navigation-rule>
             <display-name>
             Maintanance1</display-name>
             <from-view-id>
             /Maintanance1.jsp</from-view-id>
             <navigation-case>
                  <to-view-id>
                  /Close_Case.jsp</to-view-id>
             </navigation-case>
        </navigation-rule>
        <navigation-rule>
             <display-name>
             Maintanance1</display-name>
             <from-view-id>
             /Maintanance1.jsp</from-view-id>
             <navigation-case>
                  <to-view-id>
                  /Cancel_Case.jsp</to-view-id>
             </navigation-case>
        </navigation-rule>
        <navigation-rule>
             <display-name>
             Close_Case</display-name>
             <from-view-id>
             /Close_Case.jsp</from-view-id>
             <navigation-case>
                  <to-view-id>
                  /Maintanance1.jsp</to-view-id>
             </navigation-case>
        </navigation-rule>
        <navigation-rule>
             <display-name>
             Cancel_Case</display-name>
             <from-view-id>
             /Cancel_Case.jsp</from-view-id>
             <navigation-case>
                  <to-view-id>
                  /Maintanance1.jsp</to-view-id>
             </navigation-case>
        </navigation-rule>
       Plz suggest me...
    Regards.
    Shrikant

    You need to differentiate the navigation cases using from-outcome or from-action. You now say to JSF roughly: If the from view id is "maintenance.jsp" then you should go to "page1.jsp" AND "page2.jsp" AND "page3.jsp". This isn't going to work, you should tell JSF roughly: If the from view id is "maintenance.jsp" AND the outcome is "page1" then you should go to "page1.jsp" and so on. You can also just leave away the from-view-id and use from-outcome and/or from-action only, as I suggested before. This way you can go everything from everything: If the outcome is "page1" then you should go to "page1.jsp".
    E.g.<h:commandLink action="page1">
    <navigation-rule>
        <navigation-case>
            <from-outcome>page1</from-outcome>
            <to-view-id>page1.jsp</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>page2</from-outcome>
            <to-view-id>page2.jsp</to-view-id>
        </navigation-case>
        ... (etc)
    </navigation-rule>Edited by: BalusC on 28-apr-2009 11:20 (sorry, a typo in the navigation cases)

  • Re: problem getting navigation rules to work

    Hello,
    I am using EA4, JDK1.4.2, Tomcat 4.1.24, under Solaris 8.
    When I click on the buttons, I always go back to the original page (EmailLookup.jsp) rather than following the navigation rules.
    I print to a file when invoke in Action is called, in my classes, so I know that when I click on the search or clear buttons that the correct action is being ran, through my properties.
    I don't know why this is not working, and would appreciate some help.
    <navigation-rule>
    <from-tree-id>/EmailLookup.jsp</from-tree-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <from-action-ref>EmailSearchModel.searchAction</from-action-ref>
    <to-tree-id>/response.jsp</to-tree-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>reset</from-outcome>
    <from-action-ref>EmailSearchModel.resetAction</from-action-ref>
    <to-tree-id>/index.html</to-tree-id>
    </navigation-case>
    </navigation-rule>
    resetAction = new Action() {
    public String invoke() {
    reset();
    try {
    java.io.FileOutputStream fos =
    new java.io.FileOutputStream("/usr/local/apps/tomcat/webapps/EmailLookup/debugtemp.txt", true);
    fos.write(new String("Inside getResetAction\n\n").getBytes());
    fos.write(new String("reset\n\n").getBytes());
    fos.close();
    } catch(Exception e) {
    return "reset";
    searchAction = new Action() {
    public String invoke() {
    try {
    java.io.FileOutputStream fos =
    new java.io.FileOutputStream("/usr/local/apps/tomcat/webapps/EmailLookup/debugtemp.txt", true);
    fos.write(new String("Inside getSearchAction\n\n").getBytes());
    fos.write(new String("success\n\n").getBytes());
    fos.close();
    } catch(Exception e) {
    return "success";
    <h:command_button label="Search"
    commandName="submit" actionRef="EmailSearchModel.searchAction" />
    <h:command_button label="Clear"
    commandName="reset" actionRef="EmailSearchModel.resetAction" />
    Thank you.

    Problem solved, it ended up being that the directory name was the same as the first JSP page, it appears.
    My directory was EmailLookup, and since the JSP page was EmailLookup.jsp, and EmailLookup was referenced in the faces-config.xml file, there was confusion.
    I changed the directory name to DirectorySearch, and it works fine.

  • How to add the ability to put EL expressions in Navigation Rules

    I had a need to dynamically determine what page to return to in a JSF application. There has to be an easier way, but here's how I wanted to do it. I wanted to put an EL expression in my <to-view-id> nav rules in the JSF config file (e.g. faces-config.xml). This isn't allowed. So I built my own custom ViewHandler to do it.
    1) Define the ViewHandler in faces-config.xml:
         <application>
              <view-handler>com.msd.tts.pluggable.MyDynamicViewHandler</view-handler>
         </application>2) Create the class:
    package com.msd.tts.pluggable;
    import java.io.IOException;
    import java.util.Locale;
    import javax.faces.*;
    import javax.faces.application.ViewHandler;
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.*;
    import javax.faces.el.ValueBinding;
    import com.sun.faces.util.Util;
    * Adds ability to put EL expressions in the <to-view-id> Navigation Rules in JSF
    * configuration file (faces-config.xml).
    * @author          Craig Peters
    * @version          1.0
    public class MyDynamicViewHandler extends ViewHandler {
         * The original handler we are customizing.
        private ViewHandler prevHandler = null;
        /** Creates a new instance of MappingViewHandler. By including
         * a parameter of the same type, we encourage the JSF framework
         * to pass a reference of the previously used ViewHandler. This way
         * we can use all the previous functionality and override only the
         * method we are interested in (in this case, the getActionURL() method).
         public MyDynamicViewHandler(ViewHandler prevHandler) {
              this.prevHandler = prevHandler;
         @Override
         public String getActionURL(FacesContext context, String viewId) {
              return prevHandler.getActionURL(context, viewId);
         @Override
         public Locale calculateLocale(FacesContext context) {
              return prevHandler.calculateLocale(context);
         @Override
         public String calculateRenderKitId(FacesContext context) {
              return prevHandler.calculateRenderKitId(context);
         @Override
         public UIViewRoot createView(FacesContext context, String viewId) {
              return prevHandler.createView(context, viewId);
         @Override
         public String getResourceURL(FacesContext context, String path) {
              return prevHandler.getResourceURL(context, path);
         @Override
         public void renderView(FacesContext context, UIViewRoot viewToRender)
                   throws IOException, FacesException {
              String result = viewToRender.getViewId();
              if (Util.isVBExpression(viewToRender.getViewId())) {
                   ValueBinding vb = context.getApplication().createValueBinding(viewToRender.getViewId());
                   result = vb.getValue(context).toString();
              if (result.charAt(0) != '/')
                   throw new IllegalArgumentException("Illegal view ID " + result + ". The ID must begin with '/'");
              viewToRender.setViewId(result);
              prevHandler.renderView(context, viewToRender);
         @Override
         public UIViewRoot restoreView(FacesContext context, String viewId) {
              return prevHandler.restoreView(context, viewId);
         @Override
         public void writeState(FacesContext context) throws IOException {
              prevHandler.writeState(context);
    }3) Use EL in navigation rules:
         <navigation-rule>
              <from-view-id>/CommonForm.jsp</from-view-id>
              <navigation-case>
                   <to-view-id>#{bean.caller}</to-view-id>
              </navigation-case>
         </navigation-rule>The "bean.caller" method will have saved the page to go back to.
    Comments are welcome. I just didn't see any other way to dynamically go back to an arbitrary page.
    Thanks.

    CraigRPeters wrote:
    Comments are welcome.Nice stuff. But that means that navigation is hardwired in the backing bean instead of faces-config.xml. Forget this comment if you've maintained a propertiesfile/configurationfile for that.
    I just didn't see any other way to dynamically go back to an arbitrary page.You can declare more than one from-outcome and/or from-action for one from-view-id.

  • Dynamic navigation - reading specified Navigation rules -how?

    Hi!
    for my application I need to read in the navigation rules which are specified in faces.xml. Depending on which data to show I want to check if there is a specific navigation rule for this object. If yes, this naviation rule is used, otherwise I want to use a generic template.
    E.g. if the object "order" should be displayed I want to check if there a navation rule named "templ_order". If so, I return this navigation rule, if not, I want to use "templ_generic".
    How can this be done?
    Or is there another way to do this ?
    Thanks for your help

    you have to override the NavigationHandler class

  • URL Customization Using Experience Rules

    We've got a bit of a sticky problem and am wondering if anyone can point me in the right direction.
    We've used experience rules to point custom URLs to communities. However, when another user types in a URL to access a community on the portal, the previous URL appears as a link in every navigation link and login on the portal. In other words, the minute the user chooses a link from the dropdown menu or logs in, they are taken to the previous community. Thereafter, the header, footer and colors from the rules of the previous community show up in every community the user goes to.
    This is extremely frustrating and confusing to our users. It appears that URLs are being cached in the navigation and/or experience rules configuration is overriding.
    Has anyone else had this experience? Is there a way around this problem? Any ideas would be greatly appreciated.
    Jo
    PS - Please forgive if you see this twice - I think I posted to the wrong forum earlier
    Edited by: user10368007 on Sep 26, 2008 9:19 AM

    Can you give us a little bit of context on which product you've been working with?
    Thanks in advance

Maybe you are looking for

  • BO4 Installation on AIX with DB2

    Hello, I hope this is the correct forum in which to pose such a question. We are currently planning an installation of BO4 on AIX and our standard choice of database platform is DB2 UDB V9.7. I have analysed the numerous SAP planning and installation

  • How to handle error in Syncrounous Send step in BPM.

    Hi All, i am inserting the data into target database and getting the response from the target database in to XI(BPM) here i am sending the data as a bunch(packets), i mean i am splitting the recods into packets and inserting these packets into target

  • BPEL not started until time out

    Hi, In my BPEL Process,I have flowN activity, each branch(each flow) has HumanTask activity which sends mail & get response from the assignee. When I invoke the process, it gets started but not send any mail until the timeout. If the process timed ou

  • Wireless charger and finger registered

    When can we expect with all these features

  • Remote Connectivity Addon for SAP B1

    can anyone send me information for remote connectivity for 5 user is there any addon available