You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anjali Jain <An...@NIIT.com> on 2002/06/12 11:07:15 UTC

workflow example explaination.

Hi All,

can anybody explain me the foll struts-config.xml...?? Especially
<set-property> tag supposed to do ...??
I've picked up this file from struts workflow example.


struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">

<!--
     This is the Struts configuration file for the workflow example 
     application.
-->


<struts-config>

<!-- ========== Form Bean Definitions ===================================
-->
<form-beans>

	<!-- Login form bean -->
	<form-bean name="loginForm"
type="com.livinglogic.struts.workflow.test.LoginForm"/>

</form-beans>

<!-- ========== Global Forward Definitions ==============================
-->
<global-forwards>
  <!-- this happens, when an authentication exception is thrown -->
  <forward name="authenticationexception"
       path="/authenticationException.jspp" />

  <!-- this happens, when we are in maintenance mode, i. e. debug level is
-1 -->
  <forward name="maintenance" path="/maintenance.jspp" />

  <!-- this happens, if the workflow data do not match -->
  <forward name="controlflowexception" path="/controlFlowException.jspp"/>

  <!-- this happens, when any kind of exception occurs in one of the actions
       and debug level is 0
  -->
  <forward name="exception" path="/exception.jspp" />
</global-forwards>

<!-- ========== Action Mapping Definitions ==============================
-->
<action-mappings>

  <!-- ===== Login/logout workflow ===== -->

  <!-- Display login -->
  <action path="/displayLoginAction"
          type="com.livinglogic.struts.workflow.SuccessAction">
    <set-property property="primaryWorkflow" value="login" />
    <set-property property="newState" value="1" />
    <set-property property="nextState" value="2" />
    <forward name="success" path="/login.jspp" />
  </action>

  <!-- Execute login -->
  <action path="/loginAction"
          type="com.livinglogic.struts.workflow.test.LoginAction"
          name="loginForm"
          scope="request"
          input="/login.jspp">
    <set-property property="primaryWorkflow" value="login" />
    <set-property property="prevState" value="1" />
    <set-property property="newState" value="2" />
    <set-property property="endWorkflow" value="true" />
    <forward name="success" path="/displayInHomeAction.do" />
  </action>

  <!-- Execute logout -->
  <action path="/logoutAction"
          type="com.livinglogic.struts.workflow.test.LogoutAction">
    <forward name="success" path="/displayLoginAction.do" />
  </action>

  <!-- Display the main page after login -->
  <action path="/displayInHomeAction"
          type="com.livinglogic.struts.workflow.SuccessAction">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/beginWf1Transition"
          type="com.livinglogic.struts.workflow.test.Wf1Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf1" />
    <set-property property="newState" value="1" />
    <set-property property="nextState" value="2" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/wf1St2Transition"
          type="com.livinglogic.struts.workflow.test.Wf1Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf1" />
    <set-property property="prevState" value="1" />
    <set-property property="newState" value="2" />
    <set-property property="nextState" value="2" />
    <set-property property="nextState" value="3" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/wf1St2Loop"
          type="com.livinglogic.struts.workflow.test.Wf1Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf1" />
    <set-property property="prevState" value="2" />
    <set-property property="nextState" value="2" />
    <set-property property="nextState" value="3" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/wf1St3Transition"
          type="com.livinglogic.struts.workflow.test.Wf1Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf1" />
    <set-property property="newState" value="3" />
    <set-property property="nextState" value="0" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/endWf1Transition"
          type="com.livinglogic.struts.workflow.test.Wf1Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf1" />
    <set-property property="prevState" value="3" />
    <set-property property="newState" value="0" />
    <set-property property="endWorkflow" value="true" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/beginWf2Transition"
          type="com.livinglogic.struts.workflow.test.Wf2Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf2" />
    <set-property property="newState" value="1" />
    <set-property property="nextState" value="2" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/wf2St2Transition"
          type="com.livinglogic.struts.workflow.test.Wf2Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf2" />
    <set-property property="prevState" value="1" />
    <set-property property="newState" value="2" />
    <set-property property="nextState" value="3" />
    <set-property property="nextPath" value="/beginWf3Transition" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/wf2St3Transition"
          type="com.livinglogic.struts.workflow.test.Wf2Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf2" />
    <set-property property="prevState" value="2" />
    <set-property property="newState" value="3" />
    <set-property property="nextState" value="0" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/endWf2Transition"
          type="com.livinglogic.struts.workflow.test.Wf2Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf2" />
    <set-property property="prevState" value="3" />
    <set-property property="newState" value="0" />
    <set-property property="endWorkflow" value="true" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/beginWf3Transition"
          type="com.livinglogic.struts.workflow.test.Wf3Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf3" />
    <set-property property="newState" value="1" />
    <set-property property="nextState" value="2" />
    <set-property property="secondaryWorkflow" value="wf2" />
    <set-property property="prevState" value="2" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/wf3St2Transition"
          type="com.livinglogic.struts.workflow.test.Wf3Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf3" />
    <set-property property="prevState" value="1" />
    <set-property property="newState" value="2" />
    <set-property property="nextPath" value="/endWf3Transition" />
    <forward name="success" path="/inHome.jspp" />
  </action>

  <action path="/endWf3Transition"
          type="com.livinglogic.struts.workflow.test.Wf2Action">
    <set-property property="authtype"
value="com.livinglogic.struts.workflow.test.Authentication" />
    <set-property property="primaryWorkflow" value="wf2" />
    <set-property property="newState" value="3" />
    <set-property property="nextState" value="0" />
    <set-property property="secondaryWorkflow" value="wf3" />
    <set-property property="prevState" value="2" />
    <set-property property="endWorkflow" value="true" />
    <forward name="success" path="/inHome.jspp" />
  </action>
</action-mappings>

</struts-config>



----anjali

Power your enterprise with custom solutions in eLearning and Knowledge
Management from NIIT - Knowledge Solutions. For details visit our website
http://www.ksb.niit.com 

___________________NOTICE____________________________ 
This electronic mail transmission contains confidential information intended
only for the person(s) named.  Any use, distribution, copying or disclosure
by any other person is strictly prohibited. If you received this
transmission in error, please notify the sender by reply e-mail and then
destroy the message.  Opinions, conclusions, and other information in this
message that do not relate to the official business of NIIT shall be
understood to be neither given nor endorsed by NIIT When addressed to NIIT
clients, any information contained in this e-mail is subject to the terms
and conditions in the governing client contract.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: workflow example explaination.

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 12 Jun 2002, Anjali Jain wrote:

> Date: Wed, 12 Jun 2002 14:37:15 +0530
> From: Anjali Jain <An...@NIIT.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: workflow example explaination.
>
> Hi All,
>
> can anybody explain me the foll struts-config.xml...?? Especially
> <set-property> tag supposed to do ...??
> I've picked up this file from struts workflow example.
>

The <set-property> tag is a general way to set JavaBeans properties on an
underlying implementation class, even though the property name is not
defined as a valid element in the DTD.

>   <!-- Display login -->
>   <action path="/displayLoginAction"
>           type="com.livinglogic.struts.workflow.SuccessAction">
>     <set-property property="primaryWorkflow" value="login" />
>     <set-property property="newState" value="1" />
>     <set-property property="nextState" value="2" />
>     <forward name="success" path="/login.jspp" />
>   </action>
>

This logic assumes that the SuccessAction class has public setter methods
setPrimaryWorkflow(), setNewState(), and setNextState() -- you can still
configure them in struts-config.xml even though these property names are
not allowed on the <action> element itself.

Many of the Struts elements allow <set-property> tags to be nested inside
-- check out the Struts DTD for more information.

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>