KickStart

With ploinFaces you can define flows for your JSF-Application. A flow has several views (xhtml or JSP or something different) and attributes (ManagedBeans). If you leave a flow, the framework removes the attributes from the session. It works with the standard http-session scope. You need no special conversation scope.

Dependencys

At a minimum, to use ploinFaces you need:

  • log4j-1.2.13.jar
  • commons-logging-api-1.1.jar
  • commons-logging-1.1.jar
  • jsf-api.jar OR myfaces-api.jar
  • jsf-impl.jar OR myfaces-impl.jar
  • servlet-api.jar
  • dom4j-1.6.1.jar
  • jaxen-1.1.1.jar
If you have set up a JSF-App. this APIs should already been in your Classpath.

Download

Download the ploinFaces.jar from sourceForge and add it to your Classpath.

http://sourceforge.net/project/showfiles.php?group_id=228979

Configuration

To set up the Framework you have to add the BackNavigationHandler from ploinFaces to your faces-config.xml.

<application>
<system-event-listener>
<system-event-listener-class> org.ploin.web.faces.core.PhaseListenerInstallationListener </system-event-listener-class>
<system-event-class> javax.faces.event.PostConstructApplicationEvent </system-event-class>
</system-event-listener>
<navigation-handler> org.ploin.web.faces.core.BackNavigationHandler </navigation-handler>
</application>

Bean-Definition

The managedBean you are using in a flow, should be in the session scope. PloinFaces is not responsible for the cration of the beans. For the creation and managing of your managedBeans you can use the standard JSF-Bean-Container configured in the faces-config.xml.

    <managed-bean>
<managed-bean-name>logInOutBean</managed-bean-name>
<managed-bean-class>org.company.project.java.gui.model.LogInOutBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

Flow-Definition

ploinFaces expects the flow definition in a file "ploinFlows.xml" in your src-folder, where normaly your "*.java" files, hibernate.properties and log4j.properties are placed, too. Here is an example for a flow with three pages. The Managed-Bean "logInOutBean" has session scope.

<flows xmlns="http://www.ploinfaces.org/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ploinfaces.org/schema http://www.ploinfaces.org/schema/ploinFlows_1.4.xml.xsd">
<flow id="loginFlow">
<views>
<view>/login.xhtml</view>
<view>/page/help/agbLogin.xhtml</view>
<view>/page/help/haftungLogin.xhtml</view>
</views>
<attributes>
<attribute>logInOutBean</attribute>
</attributes>
</flow>
</flows>

If you leave the flow, ploinFaces removes the logInOutBean from the session. Furthermore you can use java-regex for the views. Here is the next example.

<flows xmlns="http://www.ploinfaces.org/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ploinfaces.org/schema http://www.ploinfaces.org/schema/ploinFlows_1.4.xml.xsd">
<flow id="useradministrationFlow">
<views>
<view>/page/useradmin.*</view>
</views>
<attributes>
<attribute>useradminBean</attribute>
<attribute>secureBean</attribute>
</attributes>
</flow>
</flows>

Every View starting with "/page/useradmin" is part of the flow.

You can enter and leave a flow at any point. ploinFaces removes all attributes from the session, which are defined with the flow.