Hi, I am trying to use @Wizard for editing existing database record, but have some difficulties with the behavior of the WizardFieldTag.
I made a simple webapp with an action bean and a POJO to explain my problem (the WAR can be downloaded from the following page). http://homepage.mac.com/ave/FileSharing2.html -- @Wizard(startEvents = { "start" }) public class WizActionBean implements ActionBean { private ActionBeanContext context; public ActionBeanContext getContext(){return context;} public void setContext(ActionBeanContext context){this.context = context;} private Person person; public Person getPerson() {return person;} public void setPerson(Person person) {this.person = person;} @DefaultHandler public Resolution start() { return new ForwardResolution("/WEB-INF/jsp/Start.jsp"); } public Resolution next() { // Displays 'confirmation screen' before committing. return new ForwardResolution("/WEB-INF/jsp/Next.jsp"); } public Resolution last() { // Want to store person to database here. return new ForwardResolution("/WEB-INF/jsp/Last.jsp"); } @Before(stages = LifecycleStage.BindingAndValidation) private void rehydrate() { // In the real solution, person is retrieved from DB. person = new Person(); person.setId(999); person.setName("Your name"); person.setHonest(true); } } public class Person { private Integer id; private String name; private boolean honest; // accessors } -- The first screen (Start.jsp) has the following form. <ss:form beanclass="action.WizActionBean"> Id: ${actionBean.person.id}<br /> Name: <ss:text name="person.name" /><br /> Honest: <ss:checkbox name="person.honest" /><br /> <ss:submit name="next" value="Next" /> </ss:form> Because of the @Before interceptor, the above form is filled when it's rendered [name='Your Name', honest='checked']. If I clear the name field and uncheck the honest checkbox then submit the form, next event is executed. During the next event, person is rehydrated, the submitted parameters are bound and the Next.jsp is displayed. Here's the form on the Next.jsp. <ss:form beanclass="action.WizActionBean"> Id: ${actionBean.person.id}<br /> Name: ${actionBean.person.name}<br /> Honest: ${actionBean.person.honest}<br /> <ss:submit name="last" value="Submit" /> </ss:form> At this point, everything seems to be OK; the name is displayed as blank and the value of the honest is false. But actually, the rendered form does not contain hidden fields for both 'person.name' and 'person.honest' because the WizardFieldTag only outputs submitted parameters with non-empty values. As a result, if I submit the above form to save the changes I have made, the person instance that I can get in the last() event handler is just the same as the rehydrated one [name='Your Name', honest='true']. -- My question is: (a) is my usage of the @Wizard incorrect? (b) shouldn't WizardFieldTag take (1) '__fp' parameter and (2) parameters which have empty values into account when rendering hidden fields? Thanks, Iwao ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
