Page Navigation wont work!
razwed4ik Oct 19, 2007 7:48 PMHi,
i had a working project with Myfaces+ facelets. After Installing Richfaces my Navigation is not working anymore. It stucks in the home page.
Add Rich Component is working very well. But at first i need my old functionality back , then i can use rich components.
This is my code:
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>TESTING</display-name> <!-- [INSERT FRAGMENT HERE] --> <!-- Define the basename for a resource bundle for I18N --> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>messages</param-value> </context-param> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value>/WEB-INF/taglibs/tomahawk.taglib.xml</param-value> </context-param> <context-param> <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext-global.xml</param-value> </context-param> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>blueSky</param-value> </context-param> <!-- TODO Was macht das? --> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>richfaces</filter-name> <servlet-name>faces</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <!--put messages from the session and put them into request, they're not lost in a redirect --> <filter> <filter-name>messageFilter</filter-name> <filter-class>net.talentx.web.MessageFilter</filter-class> </filter> <!-- realizing the OpenSessionInView Pattern with Spring, Hibernate Session will stay open till the end of rendering the jsp -> to access the lazy loaded data from the database through the HibernateSession see. Java Dev. with Spring, Johnson page. 283 --> <filter> <filter-name>lazyLoadingFilter</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> </filter> <!-- acegi Security of Spring <filter> <filter-name>securityFilter</filter-name> <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class> <init-param> <param-name>targetClass</param-name> <param-value>org.acegisecurity.util.FilterChainProxy</param-value> </init-param> </filter> --> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!--put messages from the session and put them into request, they're not lost in a redirect --> <filter-mapping> <filter-name>messageFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <filter-mapping> <filter-name>lazyLoadingFilter</filter-name> <url-pattern>*.faces</url-pattern> </filter-mapping> <!-- <filter-mapping> <filter-name>securityFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <servlet> <servlet-name>faces</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> <!-- <servlet-mapping> <servlet-name>faces</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> --> <welcome-file-list> <welcome-file>/index.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>403</error-code> <location>/WEB-INF/pages/403.jsp</location> </error-page> <error-page> <error-code>404</error-code> <location>/WEB-INF/pages/404.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/WEB-INF/pages/error.jsp</location> </error-page> <!-- Standard Exceptions Handling--> <error-page> <exception-type>java.lang.Exception</exception-type> <location>/WEB-INF/pages/error.jsp</location> </error-page> </web-app>
faces.xml
faces-config> <!-- Spring VariableResolver for JSF --> <application> <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver> <locale-config> <default-locale>en</default-locale> <supported-locale>de</supported-locale> </locale-config> <message-bundle>messages</message-bundle> </application> <navigation-rule> <from-view-id>*</from-view-id> <navigation-case> <from-outcome>home_menu</from-outcome> <to-view-id>/pages/home.xhtml</to-view-id> </navigation-case> <navigation-case> <from-outcome>profile_menu</from-outcome> <to-view-id>/pages/profile.xhtml</to-view-id> </navigation-case> </navigation-rule>
layout.xhtml
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:authz="http://acegisecurity.org/authz"> <head> <meta http-equiv="Cache-Control" content="no-store"/> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Expires" content="0"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <link rel="stylesheet" type="text/css" href="/talentx/styles/smoothstyles.css"/> <link rel="stylesheet" type="text/css" href="/talentx/styles/myfaces.css"/> <link rel="stylesheet" type="text/css" href="/talentx/styles/displaytag.css"/> <f:loadBundle var="msg" basename="messages"/> <title><ui:insert name="title">Default title</ui:insert></title> </head> <body> <div class="container"> <div class="header"> <div class="sitename"> <ui:insert name="header"> <ui:include src="header.xhtml"/> </ui:insert> </div> </div> </div> <div class="container"> <div class="main-nav"> <ui:insert name="menu"> <ui:include src="menu.xhtml"/> </ui:insert> </div> <div class="content"> <div class="contentitem"> <ui:insert name="content"> <ui:include src="content.xhtml"/> </ui:insert> </div> </div> </div> </body> </html>
header.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:authz="http://acegisecurity.org/authz"> <img src="../images/logo_mittel.gif" title="TalentX" /> </html>
menu.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:authz="http://acegisecurity.org/authz"> <h:form styleClass="menu"> <h:commandLink value="#{msg['menu.home']}" action="home_menu" styleClass="menu" /> <h:commandLink value="#{msg['menu.profile']}" action="profile_menu" styleClass="menu" /> </h:form> </html>
home.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:authz="http://acegisecurity.org/authz"> <ui:composition template="layout.xhtml"> <ui:define name="content"> <h:outputText value="#{msg['missionStatement.statement']}"/> </ui:define> </ui:composition> </html>
profile.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:authz="http://acegisecurity.org/authz"> <ui:composition template="layout.xhtml"> <ui:include name="content"> <t:messages errorClass="error" layout="table" style="width: 100%" /> <h:form id="personalInfoForm"> <h:outputText value="#{msg['profile.personal.title']}"/> <t:panelGrid columns="3" styleClass="detail" columnClasses="label"> <t:outputLabel for="firstName" value="#{msg['firstName']}"/> <t:message for="firstName" styleClass="errorMessage"/> </t:panelGrid> </h:form> </ui:include> </ui:composition> </html>
I can call profile directly in the adress bar, but not from menu! I tried to bind a bean in the menu bar for navigation, it works without Richfaces, but with, this bean is never called. I think there is smth. wrong in the Request Processing flow, but i dont know what. Somebody any ideas?
Thx in Advance