[Opensource] workflow using addStatePairing - not quite getting it
Helga Wyns
helgawyns at hotmail.com
Thu Dec 12 01:04:14 PST 2002
Yes, this time I'm sure (sorry for my misleading suggestion before). In the
perform method of my state I call the setFormCache() method (this method is
defined in the State class, and it populates the form).
Like I said, I don't know if this is a good way to handle things, but
anyway, it seems to work for my application and it's easy.
>
>Are you sure that works? StateForm is instantiated, but when I tried it
>none
>of my fields were populated.
>
>From what I can tell, the StateForm (or ControllerForm) is populated by
>struts' ActionServlet . That would mean that a form bean would have to
>follow the standard for struts, which is to have getter and setter methods
>for each field being stored.
>
>It looks like the Struts 1.1 has a DynaBean which may allow this (although
>you may still have to define all of the properties in struts-config.xml).
>But, from previous conversation, I think struts 1.1 in Expresso is a bit
>away...
>
>mike
>
>-----Original Message-----
>From: Helga Wyns [mailto:helgawyns at hotmail.com]
>Sent: Tuesday, December 10, 2002 6:23 AM
>To: opensource at jcorporate.com
>Subject: RE: [Opensource] workflow using addStatePairing - not quite
>getting it
>
>
>Mike,
>you're right, now I see what I was missing.
>I'd rather not write my own ControllerForms though, as this seems to be a
>lot of extra work to me.
>Now, I have modified the DefaultForm to extend the ControllerForm. It seems
>to work: the StateForm is instantiated in State.perform(). But I must admit
>that I don't know if it's ok to do that. Do you have any idea's?
> >
> >Aime,
> >Your sample matches my code, but I am using
> >com.jcorporate.expresso.core.controller.DefaultForm as my form bean, as
> >Helga Wyns suggested was possible. In State.perform(), StateForm is null.
>I
> >assume that's because DefaultForm doesn't work here and I need to have a
> >custom ControllerForm?
> >
> >Thanks,
> >Mike
> >
> >-----Original Message-----
> >From: BSC [mailto:bsci at lycos.com]
> >Sent: Sunday, December 08, 2002 1:20 AM
> >To: opensource at jcorporate.com
> >Subject: Re: [Opensource] workflow using addStatePairing - not quite
> >getting it
> >
> >
> >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
> >_______________________________________________
> >Opensource mailing list
> >Opensource at jcorporate.com
> >http://mail.jcorporate.com/mailman/listinfo/opensource
> >Archives: http://mail.jcorporate.com/pipermail/opensource/
> >_______________________________________________
> >Opensource mailing list
> >Opensource at jcorporate.com
> >http://mail.jcorporate.com/mailman/listinfo/opensource
> >Archives: http://mail.jcorporate.com/pipermail/opensource/
>
>
>_________________________________________________________________
>Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met Hotmail
>SMS http://www.msn.nl/jumppage/
>
>_______________________________________________
>Opensource mailing list
>Opensource at jcorporate.com
>http://mail.jcorporate.com/mailman/listinfo/opensource
>Archives: http://mail.jcorporate.com/pipermail/opensource/
>_______________________________________________
>Opensource mailing list
>Opensource at jcorporate.com
>http://mail.jcorporate.com/mailman/listinfo/opensource
>Archives: http://mail.jcorporate.com/pipermail/opensource/
_________________________________________________________________
Chatten met je online vrienden via MSN Messenger. http://messenger.msn.nl/
More information about the Opensource
mailing list