Page navigation problems

Hi all,
I am new to JSF, and I am trying to implement a simple page navigation which displays some values that the user entered. The values are stored in a managed bean. It's a simple login form. I am using NetBeans as my IDE. My page navigation is set up as follows:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
And my JSF page is setup as follows:
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<webuijsf:page binding="#{index.page1}" id="page1">
<webuijsf:html binding="#{index.html1}" id="html1">
<webuijsf:head binding="#{index.head1}" id="head1">
<webuijsf:link binding="#{index.link1}" id="link1" url="/resources/stylesheet.css"/>
</webuijsf:head>
<webuijsf:body binding="#{index.body1}" id="body1" style="-rave-layout: grid">
<webuijsf:form binding="#{index.form1}" id="form1">
<webuijsf:staticText binding="#{index.staticText1}" id="staticText1" style="position: absolute; left: 144px; top: 72px" text="Enter user name:"/>
<webuijsf:staticText binding="#{index.staticText2}" id="staticText2" text="Enter password:" />
<h:inputText binding="#{user.name}" id="txtUsername" />
<h:inputText binding="#{user.password}" id="txtPass" />
<h:commandButton action="login" binding="#{index.btnLogin}" id="btnLogin" value="Log in"/>
<h:inputText binding="#{index.txtUsername}" id="txtUsername"/>
<h:inputText binding="#{index.txtPass}" id="txtPass"/>
</webuijsf:form>
</webuijsf:body>
</webuijsf:html>
</webuijsf:page>
</f:view>
</jsp:root>
The web application compiles and deploys with no problem. However, when I click the btnSubmit button, it does not redirect me to the page specified in the faces-config.xml file. Can anyone tell me what I'm doing wrong? Thanks for any help you can provide.

I'm not sure what you are trying to do here.
Are you trying to map the commandButton's action="login" to your rule <from-outcome>login</from-outcome>?
I think you want the commandButton to map to a method in your backing bean. E.g. action="#{bean.goToLogin}" .
The method goToLogin() should then return the string, "login" . This will be caught by your navigation rule <from-outcome>.
<from-outcome> maps to a specific string returned from a method called in that page.
But in this case if you just want redirection, it should be easier just an outputLink pointing to login.jsp.
Hope this helps!

Similar Messages

  • IDE bug? Page navigation problem.

    Is there any way to see all of the buttons on a page in the Page Navigation screen?
    When you left click on the page in the Page Navigation screen, it expands, but not enough to see all of the buttons.
    I have a page with a lot of buttons on it, and I can only see the first 10 of them and cannot find a way to scroll down.
    Thanks.

    A bug report has laready been filed for this issue.

  • Page navigation problem in adf application.

    Hi All,
    I developed one application in ADF that is working fine in integrated WLS. But While deployed in standalone WLS the page is not navigating.
    in my application i created two pages like in First page search with table.second page details of particular row from table for that oi used
    Execute with perms with key value method from Data-control in table for row i changed to command link when i click on link the page should be navigated to details page
    in integrated WLS but its not working in standalone WLS. please give some solution.
    Regards,
    Shankar

    Shankar,
    Did you try searching for the problem first?
    Check the URL that you are using to run your application in the standalone WLS (and compare it with the URL that you use with the integrated WLS).
    I'd guess your standalone URL has ".jspx" or ".jsf" at the end of it, which means you're running a page directly and not a taskflow view activity. Try removing the ".jspx" or ".jsf" from your URL and see what happens.
    For more explanation, you can search the forum or read the Fusion Developers Guide for ADF - this question is asked about once or twice a week.
    John

  • Tab Page Navigation Problem???

    Hi All:
    I am facing problem with tab page. when I save some record at the last tab then it moves towards its previous tab page. May be navigation becomes wrong.Record is saved. What would be the solution? Can anyody tell me. Thanks
    Ali

    Just two wonders...:
    1) Are the blocks ordered in the Object Navigator ... as they appear in the tabs of your tab canvas...????
    2) Is there in the 'save trigger' or in other place (which take place in the save process) a "go_item(<itemname_of_the_previous_tab>)" or "go_block(<block_resides_in_the_previous_tab>)"...????
    Greetings....
    Sim

  • ESS page Navigation problem EP7.0 for ERP2004

    Hi
    How are you?
    We made ESS configuration in our new NW04s SP10 portal.
    We use ECC 5.0 as back end. As we can’t install the XSS component for ERP2004 in NW04s, we add java stack in ECC 5.0 machine and installed the XSS and JCO and all there. And imported the BP for ESS 60.2 in portal EP7.0.
    Now everything is working fine that one problem.
    The problem is related to link in portal. When I click the ESS overview menu, I get the the overview with ESS menu inside the page.
    But if I click again in ESS overview menu, it changes to the overview with ESS menu inside the page. If I click again it change to first style. What I mean is, it change the every alternative time. I made all the PCD setting in IMG. And when I get the second view, and if I click in any link, the top level navigation will not work after that.
    Do you have any idea why it is so and how to fix it?
    I appreciate your support.
    Thanks
    Raibin

    It might seem like not a big problem at first, but this can be a major problem. If you are implementing filters and routing their in web.xml, you will not get the intended effect. For example, I use a filter to make sure that the user has logged in before accessing a page in the /app directory. The filter is not applied AT ALL the first time the user tries to go into the /app directory. Any way to make JSF shows the correct URL?

  • Tab pages - Navigation Problem

    Hi,
    What key I should use, if I want to navigate to other blocks in the same tab page.
    Thanks
    KC
    null

    I had this same problem. I created a TAR on Metalink about it and Oracle's response to me was to see Note#1016812.4 "KEY-NXTBLK AND KEY-PRVBLK DO NOT FIRE ON TAB PAGE".
    Basically, those triggers perform differently for tab pages.
    Solution Description:
    =====================
    The KEY-NXTBLK and KEY-PRVBLK triggers are re-defined to mean "Next Tab Page" and "Previous Tab Page" when on a tab page.
    However, you can put calls GO_ITEM or GO_BLOCK into a WHEN-TAB-PAGE-CHANGED
    trigger instead of the KEY-NXTBLK and KEY-PRVBLK triggers. This way, when
    Forms thinks you want to change tab pages, you can change blocks.
    Solution Explanation:
    =====================
    The KEY-NXTBLK and KEY-PRVBLK triggers were redefined to be consistent
    with the Microsoft standard for tab sheets.
    null

  • Page navigation problem

    Guys,
    I have two pages, each one with table with a hyperlink column. I use the same code in the hyperlink_action method for both (... return "nav-string"...).
    For one table this works, for the other not...
    I can't see a difference - navigation rules are:
    <navigation-rule>
    <from-view-id>/mplist.jsp</from-view-id>
    <navigation-case>
    <from-outcome>toMPDetails</from-outcome>
    <to-view-id>mpdetails</to-view-id>
    </navigation-case>
    <navigation-rule>
    <navigation-rule>
    <from-view-id>/pdsamlist.jsp</from-view-id>
    <navigation-case>
    <from-outcome>toPdsamDetails</from-outcome>
    <to-view-id>pdsamdetails</to-view-id>
    </navigation-case>
    <navigation-rule>Ideas? I'm stuck and/or blind...
    regards
    jbh

    a) Add h:messages on all your pages. Are there any validation or conversion errors?
    b) Are you using an action method on your submit buttons? If so, are the action methods being executed?
    CowKing

  • DataScroller, table page navigation problem

    In my case I have created page with table and datascroller. I navigate from this page to another page and then back. But here is a problem. If I begin, for example, from 3rd page of data scroller and return back, the datascroller alwas positions on first page! I wold like to return on the same page (as indicated on data scroller). What is the solution?
    Regards Simy

    I am experimenting with method setFirst(int) on HtmlDataTable component. Somewhere I have noticed that page on HtmlDataScroller is defined by setFirst(int). So in the moment when I navigate to page where HtmlDataTable is, I set method parameter to appropriate value. This is done in afterPhase method of phase listener, but it obviosly does not work, because only RENDER_RESPONSE is triggered when I return to page. Questions:
    1.) Is using setFirst(int) right way?
    2.) In which phase of lifecycle should be used?
    3.) How to trigger other lifecycle phases, not only RENDER_RESPONSE?
    Regards Simy

  • Page navigation problem using template method pattern

    Hi all,
    I've built a rather simple app implementing the template method design pattern. I've built a shared session bean which holds a hashmap of beans associated with pages I've visited. All of my JSPBeans extend from a common abstract class which calls three simple methods to process output for the page the first time displayed, everytime after the first time the page is displayed and yada yada.....so, let's say I'm three pages in, I've submitted a form and am looking at a page which displays data verifying my submit. Now, I click a link which should take me back two pages, say, to a home page. When I click the link, the home page is displayed momentarily...but then the app processes thu everything I just did up to the point where I started. It just flashes thru a few pages, resubmits the data and I end up right where I started. Automated data processing in a web app...and I wasn't even trying :-) Seriously tho, what in the world is this thing doing and how do I get it to stop! Has anyone ever seen this before?
    regards,
    Mat

    Hi John,
    I'm a little new so excuse my ignorance :-) Yep, I have session bean class which is nothing more than a hashmap of keyed beans ( I have one bean associated with each jsp). All beans are session persistent. What I don't understand is why when I attempt to navigate 'back' into the application ( a page where I have already been) the darn thing repeats. All my beans extend from a common class which includes three abstract methods...firstpassprocess(), process(), and footerprocess.() The idea is that I set a boolean var to "FIRSTPASS" the parent sees that and directs the application to the firstpassprocess() method in the concrete class. Why doesn't it do that again? U say it's because of the session bean? I tried to include some true/false values in the process() method of the concrete class which fixes the application flow. But, and there is always a but, now the submit includes all of the data from the prior submit. How do I do the auto update of the bean properties? Jeez...I hope I don't sound to silly! Thanks for the help....
    Mat

  • CrystalReportViewer page navigation re-hash

    Hi Everyone,
    I've been searching for a solution to the widely discussed page navigation problem when you place all your report binding code in Page_Load().  Lots of references are to older versions of VS and CR so they don't quite fit.  I am running VS2008 and CR2008.  Here's what I've done so far.
    Added an OnInit parameter to point to my initialization routine:
    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" DisplayGroupTree="False" EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False"
    OnInit="InitMyReport"/>
    Moved my report binding code from Page_Load to InitMyReport().  The issue I am having is that the paramaters that are being passed via the URL (and fetched via request.querystring("id1")) are not available during the initialization phase so I can't set them.
    Where did I run astray?
    Dave

    OK - I figured this out. 
    First I took all of the report setup code (parameter and selection formula assignment) and put it into its own subroutine called ReportSetup().  This is called only once from page_load as I am checking for postback.
    Next I added a new subroutine called ReportNavigate() to fire when the viewer navigate event is triggered.  This simply calles ReportSetup() which rebinds the report correctly.
    Simple solution.
    Dave

  • Print, Export and Page Navigation Buttons in the Report

    When I view a report through CR4E, the generated report has 3 buttons namely Print, Export and Page Navigation buttons. But when I click on either of the buttons I get a &#39;null pointer exception&#39;. This is a critical error as I am unable to navigate past the first page. Do I have to add code to these buttons? If not, why am I getting an error? Kindly solve my problem as soon as possible.

    <p>Looking at your code it appears that you are storing the ReportSource in session prior to passing in the ResultSet. This will create a problem when a postback is made on  the viewer page (which all of the viewer actions do). If you look at the sample code which is generated when you use the JSP Page Wizard you will notice that the ResultSet is passed to the ReportClientDocument object prior to it being stored in session. Then, when the page is called again this object is retrieved and the ReportSource is used by the viewer. You can quickly run the test using one of our sample reports to see what I am talking about. The code below was generated using the Consolidated Balance Sheet.rpt and did not experience any problems doing any of the viewer actions.</p><%@page import="com.businessobjects.samples.JRCHelperSample,<br />com.crystaldecisions.report.web.viewer.CrystalReportViewer,<br />com.crystaldecisions.reports.sdk.ReportClientDocument,<br />com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,<br />com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,<br />com.crystaldecisions.sdk.occa.report.reportsource.IReportSource,<br />java.sql.Connection,<br />java.sql.DriverManager,<br />java.sql.ResultSet,<br />java.sql.SQLException,<br />java.sql.Statement"%><%<br /><br /><br />    try {<br /><br />        String reportName = "Sample Reports/Consolidated Balance Sheet.rpt";<br />        ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);<br /><br />        if (clientDoc == null) {<br /><br />            clientDoc = new ReportClientDocument();<br />            <br />            // Open report<br />            clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);<br /><br />  <br />            {<br />                // **** POPULATE MAIN REPORT ****<br />                {<br />                     // Connection Info for fetching the resultSet<br />                    String connectStr = "jdbc:derby:classpath:/Xtreme";<br />                    String driverName = "org.apache.derby.jdbc.EmbeddedDriver";<br />                    String userName = "dbuser";        // TODO: Fill in database user<br />                    String password = "dbpassword";    // TODO: Fill in valid password<br /><br />                    String query = "SELECT CUSTOMER_NAME FROM APP.CUSTOMER WHERE COUNTRY = &#39;Australia&#39;";<br /><br />                    <br />                    String tableAlias = "FINANCIALS";        // TODO: Change to correct table alias<br /><br />                     <br />                    JRCHelperSample.passResultSet(clientDoc, fetchResultSet(driverName, connectStr, userName, password, query),<br />                        tableAlias, "");<br />                }<br /><br /><br />            }<br />        <br />            // Store the report document in session<br />            session.setAttribute(reportName, clientDoc);<br /><br />        }<br /><br /><br />            {<br />                // Create the CrystalReportViewer object<br />                CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();<br /><br />                //    set the reportsource property of the viewer<br />                IReportSource reportSource = clientDoc.getReportSource();                <br />                crystalReportPageViewer.setReportSource(reportSource);<br /><br />                // set viewer attributes<br />                crystalReportPageViewer.setOwnPage(true);<br />                crystalReportPageViewer.setOwnForm(true);<br /><br />                // Process the report<br />                crystalReportPageViewer.processHttpRequest(request, response, application, null); <br /><br />            }<br />            <br /><br />    } catch (ReportSDKExceptionBase e) {<br />        out.println(e);<br />    } <br />    <br />%><%!<br />// Simple utility function for obtaining result sets that will be pushed into the report.  <br />// This is just standard querying of a Java result set and does NOT involve any <br />// Crystal JRC SDK functions. <br /><br />    private static ResultSet fetchResultSet(String driverName,<br />            String connectStr, String userName, String password, String query) throws SQLException, ClassNotFoundException {<br /><br />        //Load JDBC driver for the database that will be queried    <br />        Class.forName(driverName);<br /><br />        Connection connection = DriverManager.getConnection(connectStr, userName, password);<br />        Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);<br /><br />        //Execute query and return result sets<br />        return statement.executeQuery(query);<br /><br />}%><p>Try using the code generated from the wizard to see if it works for you as well. </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) </p>

  • 11g Forms Tab-Page Navigation

    I am using Forms 11g on Solaris.
    A main navigator form opens another form which has a content canvas, tab-page canvas and (3) stacked canvases.
    The problem I am having is with tab-page navigation.     CTRL+TAB ( next ) and CTRL+SHIFT+TAB ( previous )
    As long as I do not initiate navigation from an item on a stacked canvas, navigation is as expected ( between tab pages only ).
    However, navigating from an item within a stacked canvas causes navigation to the parent form.
    Repeating the tab navigation keys from the parent form returns to the called form.
    Note that both key-combinations simply toggle back and forth.
    I have found no documentation on tab-page navigation so any help / insight is greatly appreciated !
    Mike

    Hi Soofi !
    Changing block order in the called form does not affect the navigation between tab pages.
    Note in my question that the resulting undesired navigation is to and from the calling form ( which only has one block ).
    Navigation between items and blocks works as expected.
    To reiterate -
         The only navigation that fails is when I attempt to CTRL+TAB or CTRL+SHIFT+TAB to another tab page from within an item on a stacked canvas.
         Attempting this navigation results in moving the cursor focus to the calling form.
         Repeating the attempt from the calling form moves back to the called form.
         None of your methods mention navigation between forms .
    Thanks for your interest.

  • Page navigation buttons not working properly

    Hi,
    I am having a multilingual Java Application (e.g. English, Japanese, French...).  In this application there are reports which display the data using locale parameter (like en_US, ja_JP etc.) to display the data in selected language.
    The problem comes up when I see Japanese reports on English operating system machine and vice versa.
    When I click any button of page navigation it changes the page number but does not load and display the page accordingly.
    It's like when I run the report it displays the first page, then clicking on Next button brings 2 in navigation field but the report  would still show first page, same happens for 3, 4.... all pages. 
    The other navigation buttons also do not work, they change the page number but display only the first page.
    This problem does not occur when I see Japanese reports on Japanese OS machine and English reports on English OS machine.
    However my clients need the first case, Japanese reports should work on English OS machine also.
    Please advise urgenly.

    Hi,
    I resolved the above issue by removing the call to method setProductLocale in jsp file (which was really unnecessary in code as product locale is meant to set languange for crystal report design environment ).
    Actually the problem was I had set locale at two place
                    1. using setLocale method of ReportClientDocument object) after the initialization of report client document object
                    2. using setProductLocale method of CrystalReportViewer object after the initialization of Crystal Report Viewer  object
    After commenting out code for setProductLocale, reports in all languages and all their functionalities started working 100% perfectly.
    Thanks.

  • Navigation Problem in OBIEE

    Hi,
    I have a strange navigation problem. I have the navigation setup from the 1st page of my dashboard to go to the second. When I first bring up the first page, and then click , nothing happens. Now if I refresh this page and then click again, I am able to navigate to the second page. I would to hear if anyone has seen similar issue. Any help is appreciated.
    Thanks,
    Bharat

    Still haven't found a solution to this problem.
    Even if I remove the form1.setTarget( null or other framename/windowname)
    I tried changing to using the onclick="from1.target='mywin';" and also onclick="form1.target='_self'; on the button. Does not work/ have the desired effect of controlling where the page is opened: in same window or in another frame or window.
    For some reason navigation also totally breaks, after a search, with a similar sql as in this message, and I get no error when I debug and step through the code.
    After doing one search, navigation seems to stop working and only the search.jsp page is the target.
    If I do a view first navigation works to new page/servlet output but still not in a new window/frame.
    This simple stuff in a normal simle html page, should not be so hard to accive with SJSC perhaps someone of you in the community or the developers at sun can give us insight into this simple problem.
    It must be fairly common that one likes to control where a page is opened, in the existing window/page/frame or in a new window/frame.
    Anybody else had any problems with navigation not working with similar code ??
    If I remove the do_search() call it works, the navigation continues to function, but still have no control of the destination window/frame.
    Kind Regards
    Roger

  • JSF 2.0 page navigation vs direct page access

    I've been experimenting with JSF for some time now and I still don't understand the page navigation part. I know that in JSF, if you aren't using the redirect option in navigation that the URL is one page behind the page you are on.
    I've seen articles where people say you should put your pages in a directory under WEB-INF to protect against directly accessing the page. I don't understand how you can create an application that is multiple pages using that option, because won't you run into the problem of having a form with an action URL of WEB-INF/somepage.xhtml?
    I've also read articles that say the way to fix this is to add security-constraints to web.xml that prevent "direct access" to pages, when you want your user to follow a page flow, such as start on page1.xhtml, then page2.xthml, then end on page2.xhtml. If page3.xhtml depends on page2.xhtml, the articles I've read say that a security constraint prevents users from simply requesting page3.xhtml out of sequence.
    And what happens if the page you are on encounters an error or the session times out, which page handles that? The one you're on, or the one from before that forwarded you to the page you're on?
    In this example, should page2.xhtml and page3.xhtml go in the root of the webapps directory, or in a directory under WEB-INF?
    Webapps
      index.xhtml
      page1.xhtml
      page2.xhtml
      page3.xhtml
      WEB-INF
        faces-config.xml
        web.xml
        page-directory
          page2.xhtml
          page3.xhtml

    A session timeout should actually net a view expiry exception.
    You do know that JSF 2.0 made page navigation that bit easier by not requiring you to do the XML configuration? There is now a convention built in plus some new components to add GET enabled requests to the JSF lifecycle (notably h:button and h:link). If you have an action method that returns the following:
    public String doSomething(){
      return "something";
    }then JSF will by default want to render a view 'something.xhtml' when you don't define any navigation rules. If you want to make that a redirect you can do this:
    public String doSomething(){
      return "something?faces-redirect";
    }(of course this is a prime target to turn into a utility method on a backing bean base class).
    Navigation rules are still necessary when you want to put views in a subdirectory, but at least this way you can greatly simplify general cases. Other than that I can only say: research research research because this material is vital to understand if you want to be productive using the framework; navigation and the 6 JSF lifecycle phases are two items you should put on the top of your list to hammer out until you really get it. A good JSF book will help you immensely there. Balusc's blog is also a good source of deeper understanding:
    http://balusc.blogspot.com/
    Most of his articles are on JSF 1.2 but most of the information still applies.
    Oh and its no surprise that you're a bit confused - this framework is not easy to pick up especially when you don't know any other web frameworks. If you keep running into a wall you should consider checking out something else like Wicket or Play framework. It might just be that JSF simply isn't the tool for the job you're trying to do.

Maybe you are looking for

  • Images not appearing in safari

    Am using Mac book pro, version 10.8.5, and a safari browser, but none of the images and icon are appearing on it, I cannot gauge whats is blockin it and is this a bug in the Mac OS or their is some problem. Even the Fonts are weired in some places la

  • Mail.app in 10.4.7: SOCKS proxy issues again...

    Hi, Today I've updated my PowerBook to MacOS X 10.4.7. All the process was fine, but Mail didn't connect to any server. After reading some posts in this forum I've unmarked the SOCKS proxy settings in the Network pref. pane, and I've recovered the 10

  • Google ActiveSync Exchange Error 403

    Hello, It all started today, while my Z10 was running brillantly, it started to have a few errors and crashing, took it back to the shop today and got a replacement (Wonderful), so setting up all my accounts, email, calender, contacts ect, i came acr

  • Creating video for a 9:16 screen (standard display mounted vertically)

    Is it possible to use FCEHD to produce a video that will be shown on a 16:9 screen that is being mounted vertically. I'm assuming I'd want to reverse the pixel numbers....i.e. swap width for height, etc. Can I do this? Is there another approach? (The

  • When will ios 7 be made available ipad mini

    When will ios 7 be made available for ipad mini