Announcement Announcement Module
Collapse
No announcement yet.
Using an output of an action for transitions. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using an output of an action for transitions.

    Hi,

    I am using SWF + JSF.
    I am curious if we can use the output of an action as the transition criterion.
    e.g. In a Login Action, the Login service returns back a boolean value true or false. Can these values true or false be used to go to different views?

    <action-state id="authenticate">
    <action bean="Authenticate" method="authenticate"/>
    <transition on="true" to="showSuccess" />
    <transition on="false" to="showError" />
    </action-state>
    I can use success or error events however I will have to write code for each of the actions to decide which output means success and which means error. Hence I want to explore the option of using the action output itself.

    I would appreciate your help.

    Regards,
    Shashi

  • #2
    ASAIK, an action bean's method can only return an Event.
    Why don't you use a plain java bean instead like this ? :

    <action-state id="authenticate">
    <bean-action bean="Authenticate" method="authenticate"/>
    <transition on="true" to="showSuccess" />
    <transition on="false" to="showError" />
    </action-state>

    The authenticate method can then return true/false as a String.
    Check the sellitem-jsf example...

    -Sriram

    Comment


    • #3
      Indeed, an <action> will invoke a direct Action implementation, so in that case you'll have to be explicit about the event you return.
      When using a <bean-action> to invoke a POJO bean method, the result is turned into an event using a ResultEventFactory. This is described in the reference documentation:
      http://static.springframework.org/sp...anActionMethod

      Look at table 2.11.

      Erwin

      Comment

      Working...
      X