Results 1 to 7 of 7

Thread: Using view and subview ID in JSF Navigation <from-view-id>

  1. #1
    Join Date
    Apr 2010
    Posts
    85

    Using view and subview ID in JSF Navigation <from-view-id>

    I am running with some difficulties and unable to fix the navigation issue : I have a simple page that include dynamically reference of different page. I need to control their navigation in different navigation way to be able to use the "outcome" names again . I considered that working with the <from-view-id> tag would be feasible for me in that case, but without any luck, it always refer to the page including main view tag in.

    So, I desired to know if it is possible to work with something else than the JSP file stated (just as the view and subview identity ) in the navigation ways to be more precise about where I occurred from?

  2. #2
    Join Date
    May 2008
    Posts
    3,316

    Re: Using view and subview ID in JSF Navigation <from-view-id>

    I would recommend, it is possible to work with NavigationHandler decorator for this very task. You can manage the navigation way of using this .I have done the modification of my jsf-tiles example to explain the suggestion . There are so many sites has explained the code for this and you also can get from those sites.

    The subview id or something just as which is not used there. Commonly , this is possible to do , but I planned to work with the the pseudo name for the view-id. I have posted below the snippet from the faces-config.xml:

    <navigation-rule>
    <from-view-id>@mainMenu</from-view-id>
    <navigation-case>
    <from-outcome>jsf</from-outcome>
    <to-view-id>/pages/jsfpage.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>orm</from-outcome>
    <to-view-id>/pages/ormpage.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>struts</from-outcome>
    <to-view-id>/pages/strutspage.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Using view and subview ID in JSF Navigation <from-view-id>

    Well. I realized that I am near to solve this out and I can get the proper solution yesterday night but you have to check it out again, I have finished the checking previously. Now, the NavigationManager contains the code displayed below. After such type of configurations , I can have as so pseudo from-view-id as I moved into the faces-config and work with them without hardcodding the specific names at any location . So, It is possible to do , to have a another navigation rule for every web site menu block..


    Code:
    package org.exadel;
     
    import javax.faces.application.NavigationHandler;
    import javax.faces.context.FacesContext;
     
     
    public class NavigationManager extends NavigationHandler {
     
     NavigationHandler _base;
     
     public NavigationManager (NavigationHandler base) {
      super();
      _base = base;
      
     }
     
     public void handleNavigation(FacesContext fc, String actionMethod, String actionName) {
      String action = actionName;
      int atPosition = action.indexOf("@");
     
      if (atPosition > -1) {
       String extViewId = action.substring(atPosition);
       fc.getViewRoot().setViewId(extViewId);
       action = action.substring(0, atPosition);
       
      }
      _base.handleNavigation(fc, actionMethod, action);
     }
    }

  4. #4
    Join Date
    Apr 2010
    Posts
    92

    Re: Using view and subview ID in JSF Navigation <from-view-id>

    Hi Modifier,
    I have used for a trial your tiles-example.it seems very nice demonstration. So I have got one question:
    When I launch the application as "http://localhost:8080/jsf-tiles/index.jsp", so I got the main page. fine , that's fine . When I click on a suggested link reference (just as Exadel ORM Studio) I got the absolute page but the URL of my browser is still display the previous URL "http://localhost:8080/jsf-tiles/pages/jsfpage.jsf" instead of "http://localhost:8080/jsf-tiles/pages/ormpage.jsf".
    How could this be?

    I have to tell, if I click one more time on "Exadel ORM Studio" I will get the absolute URL "http://localhost:8080/jsf-tiles/pages/ormpage.jsf". This would be very fine , if you could suggest me, why it's going on like this !

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Using view and subview ID in JSF Navigation <from-view-id>

    Actually, this is not an problem of the specific one example or, event, the javaserver interacts with those technology. It is a common issue for each technology where the navigation decision is adjusted on the server side after the client carried browser have been already submited the request and the address of the site displayed within the browser window is configured at that time .

    You can create the <redirect/> for the specific Navigation Case in the faces-config. The address of the site will be refined . However, the request scope will be reconfigured in this situation . Sometimes, it is not applicable .

  6. #6
    Join Date
    Apr 2010
    Posts
    92

    Re: Using view and subview ID in JSF Navigation <from-view-id>

    Thanks for the reply. I recently followed the same after getting your suggestion . When I implemented the "redirect" tag in faces-config.xml, I will get an error. I would be so happy , if you could help me again.

    This is the error:


    Code:
    500 Internal Server Error
    java.lang.NullPointerException
    	at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    	at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
    	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    	at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
    	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
    	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    	at java.lang.Thread.run(Thread.java:534)

  7. #7
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Using view and subview ID in JSF Navigation <from-view-id>

    Hi friend , I am going through your example stated , but I got some issues . The NavigationManager.handleNavigation is not called, but NavigationManager's constructor is getting accesed . Actually, I am going through the creation of example that associates JSF+Tiles, working with the JDeveloper with embedded OC4J. I have used to deploy example to tomcat in the same way, result the same. There may be possible if you have some suggestion .

Similar Threads

  1. how to view ebooks in pc?
    By Ganesh Ujwal in forum Windows Software
    Replies: 1
    Last Post: 10-12-2011, 12:40 PM
  2. Replies: 6
    Last Post: 24-09-2011, 01:32 AM
  3. How to view the images on the DVD-R
    By DeMario in forum Technology & Internet
    Replies: 3
    Last Post: 19-11-2009, 05:30 AM
  4. How to switch from Form view to Design View?
    By AlienKing in forum Software Development
    Replies: 3
    Last Post: 24-09-2009, 12:29 PM
  5. How to View Old Registry?
    By Kishan in forum Windows XP Support
    Replies: 4
    Last Post: 19-03-2007, 08:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,632,652.87244 seconds with 17 queries