JSF Example

Building a web application based on the JavaServer Faces (JSF) Framework is always a good choice as JSF is based on the model view controller (MVC) architecture for separating business logic from presentation. JavaServer Faces technology is being developed through the Java Community Process and offers a standardized and reliable web framework.

The Imixs Workflow components can be integrated easily in any JSF Web application. Using the Imixs JSF Tools allows you to concentrate on the web design and UI development.

Note:
There are several examples on the JSF-Tool examples page illustrating how to develop web applications using the Imixs JSF Tools.

The following section explains the necessary steps to integrate the Imixs Workflow into a JSF Project.

How to install

Running the Imixs Workflow in a JSF project it is necessary to add the Imixs EJB components to your project. JSF and EJBs can be bundled in an Enterprise Archive (EAR). Adding the Imixs EJB components into a JSF web project there is no need to write one line of EJB code. You simply add an EJB module to your project which refers to the Imixs Workflow components. You will find detailed informations how to build an EAR in the Imixs Workflow deployment guide.

After the Imixs JEE components are part to your Enterprise Archive (EAR) you can add the Imixs JSF-Tools to your web project. You can add the imixs-workflow-jsf.jar into the /WEB-INF/lib folder of your web module. If you are using maven (which is recommended) you can simply add the following dependency into your pom.xml

 <dependency>
        <groupId>org.imixs.workflow</groupId>
        <artifactId>imixs-workflow-faces</artifactId>
        <version>3.0.0</version> 
 </dependency>

See details about the installation of the Imixs JSF-Tools in the Imixs JSF Deployment Section.

The Imixs JSF Workflow Controller

The Imixs JSF-Tools Project provides a backing bean to be used as a workflow controller. The controller can be added as a managed bean to your faces-config.xml file:

<managed-bean>
        <managed-bean-name>workflowMB</managed-bean-name>
        <managed-bean-class>org.imixs.workflow.jee.faces.SimpleWorkflowController</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
</managed-bean> 

The SimpleWorkflowController Bean provides several action methods to create, update and delete workitems through the Imixs Workflow Manager. It also provides dynamic properties to add any kind of user input to a workitem controlled by the Imixs Workflow Manager.

The following example shows how to create a new instance of an workitem with a JSF command button:

 <h:commandButton
        value="start a new process"
        actionListener="#{workflowMB.doCreateWorkitem}"
        action="show_workitem">
        <f:param name="id"
                value="100" />
        </h:commandButton>

The workflowMB can also be used to bind input values to an JSF Input Field

 <h:inputText required="true"
        value="#{workflowMB.workitem.item['txtSubject']}" id="subject_id">
 </h:inputText>

To process (update) a workitem you can call the action method doProcess

 <h:commandButton action="show_workitem"
        actionListener="#{workflowMB.doProcessWorkitem}"
        value="submit">
        <f:param name="id" value="10" />
 </h:commandButton>

Find more examples on the JSF-Tool examples page.