[Opensource] workflow using addStatePairing - not quite getting it

BSC bsci at lycos.com
Sat Dec 7 23:19:43 PST 2002


Hi Mike,

Here's some code snippets that are working for me.  Hopefully this will help..


My Controller:
--------------

public SignIn() throws NonHandleableException {

	super();
	
	State promptState = null;
	State handleState = null;
	
	promptState = new PromptSignIn("prompt1", "Sign In");
	handleState = new ValidateSignIn("handle1", "Sign In");
	addStatePairing(promptState, handleState, null);  //Will use controller form by default
	
	handleState = new CompleteSignIn("handleFinal", "Sign IN");
	addFinalState(handleState);
}


My External State:
-----------------

public class ValidateSignIn extends State {

public void perform(StateForm stateForm, ControllerRequest request, ControllerResponse response)
			throws ControllerException, NonHandleableException {

	super.perform(stateForm, request, response);
	SignInForm signInForm = (SignInForm) stateForm;
		
	String signInID = StringUtil.notNull(signInForm.getSignInID());
	if (signInID.equals("")) {
		response.addError("Please type your ID.");
		return;
	}

<snip>



My Controller Form:
------------------

public class SignInForm extends ControllerForm {
	private String signInID;

<snip>



My Struts Config:
----------------
    <!-- Sign In form bean -->
    <form-bean      name="signInForm"
                    type="com.xxx.view.SignInForm" />


    <action path="/SignIn"
	      type="com.xxx.controller.SignIn"
            name="signInForm"
            scope="request"
            validate="false">
	  <forward name="default" path="/MainOptions.do" redirect="true"/>
        <forward name="prompt1" path="showSignIn" />
    </action>




---
Aime 




_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus



More information about the Opensource mailing list