sys_debug
sys_debug

Reputation: 4003

Java JSF navigation URL Issue?

Ok the following code is what I have in a drop down menu on my facelets to visit different pages.

 <p:toolbarGroup align="right">  
            <p:menuButton value="Navigate">  
                <p:menuitem value="Home" url="index.xhtml" />  
                <p:menuitem value="Reservation Form"  
                            url="form.xhtml" />  
                <p:menuitem value="Pending Requests"  
                            url="pending.xhtml" />  
            </p:menuButton>  
        </p:toolbarGroup>  

      </p:toolbar>  

Now the issue is, sometimes and I emphasize sometimes when I press on a link to another page, it goes there but the URL address in the bar doesn't change. so it says index.xhtml example when am looking at form.xhtml.

Another thing i noticed was the auto-complete issue. So sometimes the auto-complete in the form page would load all the entries I had before and other times it doesn't even though it is same page. All these indicate that the page is treated differently here in two occasions. So When I submit the form, sometimes it works and other times it just fails (at FacesContext dispatch part) although the data is actually stored correctly in DB. Ay ideas? Thanks,

Upvotes: 0

Views: 972

Answers (1)

Matt Ball
Matt Ball

Reputation: 359776

For the first issue, add ajax="false" on each <p:menuitem> so that the browser does not use an ajax request to load the specified page.

<p:toolbarGroup align="right">  
    <p:menuButton value="Navigate">  
        <p:menuitem value="Home" url="index.xhtml" ajax="false" />
        <p:menuitem value="Reservation Form" url="form.xhtml" ajax="false" />
        <p:menuitem value="Pending Requests" url="pending.xhtml" ajax="false" />
    </p:menuButton>  
</p:toolbarGroup>

Upvotes: 1

Related Questions