First, environment details:
JSF 2.0 with PrimeFaces 3.3
Glassfish 3.1
Mojarra 2.1.6
Firefox 13.1 (but I've tried this in Chrome, Safari, IE and the behavior is the same)
I'm implementing a very common use case -- accordion menu on the right, clicking buttons loads a page in a center panel. To summarize the problem, if the user logs in and clicks a menu button, the button's action listener stores the target page in a bean, then updates the center section which extracts the url from the bean and loads the page. This at first appears to work, but there is a <p:selectOneMenu> on the target page that shows a list of users; selecting an entry from the list updates the user info on the screen -- simple. However, when I make a selection from the dropdown it does not dismiss. It just displays my selection in the input area of the component, but the menu itself does not dismiss and nothing in the attached bean (listeners, converter) fires. Clicking the selection again in the dropdown causes the menu to disappear, but still no action is taken.
Here's the confusing part -- I've obviously missed some detail: The login page is index.xhtml. Upon successful login, it navigates to main_menu.xhtml which references a facelet template that contains the Primefaces layout. main_menu.xhtml inserts the accordion into the west section of the layout. Under normal conditions, the browser URL continues to refer to index.xhtml; no problem with that, but if after I've initiated the session I type main_menu.xhtml directly into the browser url, the whole thing works exactly as it should. I can even log out and log back in and it will continue to work, all the time showing main_menu.xhtml in the browser url.
Here are the details (fwiw, forms are all defined as <h:form> -- I believe I've eliminated the easy setup stuff that could be derailing me):
Here's the submit button definition in index.xhtml:
<td colspan="2"><p:commandButton id="submit_login" value="#{msg.login_button}" action="#{sessionInfo.login}" update="focus" ajax="false"/></td>
The login falls into the default navigation rule here:
<navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>CALLCENTER</from-outcome>
<to-view-id>/callcenter.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>FAILED</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<to-view-id>/main_menu.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
Salient excerpts from my facelet template:
<h:body>
<p:layout fullPage="true">
.
.
.
<p:layoutUnit id="main_lu_center" position="center">
<p:outputPanel id="main_panel_center">
<ui:insert name="content">
<ui:include src="#{nav.getPage('main_panel_center','/dashboard.xhtml')}" />
</ui:insert>
</p:outputPanel>
</p:layoutUnit>
The getPage method just looks up the page to display based on the first param. The second param is just a default in case the requested mapping is not found.
Here are the pieces of main_menu.xhtml where it references the template and the commandButton that posts the page to display in the center section and updates the section:
<ui:composition template="/templates/master-layout.xhtml">
.
.
.
<p:commandButton value="#{msg.user_modify_tab}"
actionListener="#{nav.setPage('main_panel_center','/user/modify_user.xhtml')}"
update=":main_panel_center"
/>
The guts of modify_user.xhtml. I don't call user_details directly because it handles both the add and modify user scenarios, morphing slightly based on the 'mode' param:
<ui:composition>
<h:form id="modify_user_form">
<ui:include src="/user/user_details.xhtml" >
<ui:param name="mode" value="modify" />
</ui:include>
</h:form>
</ui:composition>
And finally, the select menu from user_details. Pardon all the noise, but this particular component is only accessible to certain users, plus is not rendered at all when adding a user:
<h:outputLabel value="#{msg.user_username}" />
<p:selectOneMenu id="username_menu" value="#{user.selectedUser}"
disabled="#{!sessionInfo.hasAccess('UPDATE','USER_MODIFY','USER_NAME')}"
valueChangeListener="#{user.enableLoad}"
rendered="#{mode == 'modify'}" >
<f:converter converterId="userConverter" />
<f:selectItems value="#{user.userList}" />
<f:ajax event="change"
render="email email_confirm first_name last_name passwd passwd_confirm authorization" />
</p:selectOneMenu>
So, what am I missing? Again, once I log in, this all works perfectly IF I manually enter main_menu.xhtml into the browser, but not if I work off of the basic login navigation. The last tidbit of information is that if I have the FF error console open, when this fails, I get 'Mojarra is not defined' followed by this url:
http://localhost:9090/reclient/faces/javax.faces.resource/jquery/jquery.js?ln=primefaces. Based on a suggestion in another post, I pasted that URL into my browser and got the jquery.js page. Here's the header at top of the listing:
/*
* jQuery JavaScript Library v1.7.2
*
http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
*
http://jquery.org/license
*
* Includes Sizzle.js
*
http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Wed Mar 21 12:46:34 2012 -0700
*/
The 'Mojarra ...' error does not show up when I go directly to main_menu.xhtml.
I'm at a loss. It appears to be losing its idea of where it is, but I can't for the life of me sort it out. I'm very new to the JSF world, so I'm probably missing something simple, but hours of forum searches seem to get close, but still no luck.
Thanks.