RichFaces 3.1.6 on OC4J 10.1.3
scattie Jun 25, 2008 9:56 AMHello,
I've been been trying to develop a simple application using RichFaces on the OC4J 10.1.3, but I'm having some problems. I've been trying to get this going for 3 days now, but no luck yet.
Since I'm using OC4J 10.1.3 and this server does not support JSF 1.2 yet, I've had to resort to RichFaces 3.1.6. However, I can't get a simple form going. The page does seem to display correctly, but whenever I click my submit button, the page just seems to redirect to itself, not even entering the action of the backing bean. Really frustrating, because I can't seem to locate the source of the problem.
This is my login page:
<%@ page contentType="text/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<f:view>
<html>
<head>
<link rel="stylesheet" href="resources/tmm.css" type="text/css" >
<title>Login</title>
</head>
<body>
<rich:panel id="Content_Panel" >
<f:facet name="header">
<h:outputText id="Out_Login" value="Please login"/>
</f:facet>
<h:form>
<h:panelGrid id="Content_Grid" columns="2">
<h:outputText value="User name:" />
<h:inputText id="username" value="#{tmSession.username}"/>
<h:outputText value="User password:"/>
<h:inputSecret id="psswd" value="#{tmSession.psswd}"/>
<h:commandButton value="Login" action="#{tmSession.logIn}"/>
</h:panelGrid>
</h:form>
</rich:panel>
</body>
</html>
</f:view>
The backing bean:
package com.xplanation.tm.client.web.maintenance.bean;
public class TmSessionBean {
private String username;
private String psswd;
private boolean loggedIn;
public TmSessionBean() {
System.out.println("CREATED TM SESSION");
}
public String getUsername() {
System.out.println("GET username");
return username;
}
public void setUsername(String username) {
System.out.println("SET username: " + username);
this.username = username;
}
public String getPsswd() {
System.out.println("GET psswd");
return psswd;
}
public void setPsswd(String psswd) {
System.out.println("SET psswd: " + psswd);
this.psswd = psswd;
}
public boolean isLoggedIn() {
return loggedIn;
}
public String logIn() {
System.out.println("LOG IN");
loggedIn = true;
return "loginSuccess";
}
}
When the page loads, it prints:
CREATED TM SESSION
GET username
GET psswd
When I click the login button, it just prints the two GETs again while I get redirected to my login page!
The faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<managed-bean>
<managed-bean-name>tmSession</managed-bean-name>
<managed-bean-class>com.xplanation.tm.client.web.maintenance.bean.TmSessionBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/Login.jsp</from-view-id>
<navigation-case>
<from-action>#{tmSession.logIn}</from-action>
<from-outcome>loginSuccess</from-outcome>
<to-view-id>Home.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{tmSession.logIn}</from-action>
<from-outcome>loginFailure</from-outcome>
<to-view-id>Login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/Menu.jsp</from-view-id>
<navigation-case>
<from-outcome>goToHome</from-outcome>
<to-view-id>Home.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>goToNewProject</from-outcome>
<to-view-id>ProjectNew.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>goToTasks</from-outcome>
<to-view-id>ProjectList.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>logOut</from-outcome>
<to-view-id>Login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
The web.xml:
<?xml version="1.0"?> <web-app version="2.4" 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"> <display-name>TM Maintenance</display-name> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>blueSky</param-value> </context-param> <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</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <filter> <display-name>Ajax4jsf Filter</display-name> <filter-name>ajax4jsf</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>ajax4jsf</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>FORWARD</dispatcher> <dispatcher>REQUEST</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <login-config> <auth-method>BASIC</auth-method> </login-config> <session-config> <session-timeout>60</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
The libs included with my WAR file are the following:
- commons-beanutils-1.7.jar
- commons-collections-3.2.jar
- commons-digester-1.8.jar
- commons-el.jar
- commons-logging-1.1.jar
- el-api.jar
- jsf-api.jar (1.1_01)
- jsf-impl.jar (1.1_01)
- jstl.jar
- mysql-connector-java-3.1.10-bin.jar
- oraclexsql.jar
- richfaces-api-3.1.6.GA.jar
- richfaces-impl-3.1.6.GA.jar
- richfaces-ui-3.1.6.GA.jar
- standard.jar
- xercesImpl.jar
Please, if anyone has any idea with might be the problem...
I've searched the net but I have not found anyone with a similar problem. According to the documentation of RichFaces 3.1.6, it is supposed to work on OC4J, but I cannot get it to.
Any help would be VERY much appreciated. Thanks!
Best regards,
Stijn