Kam Lung Leung wrote: > Why don't I get a pop up dialog box with error messages? > Why the secondPage.jsp did not get executed when a validation > error occurred? > Why do I get a blank screen?
Are you sure that it's blank? Sometimes the page doesn't render because of errors in the HTML, which might only be exposed when the page is trying to display error messages.
I'm not sure why you would reset everything if getPage() is equal to 2. The usual approach is to allow the properties to accumulate, until the end of the workflow, and then dispose of the (session-scoped ActionForm altogether. Generally, the only thing you ever need to reset is a checkbox to false on a session-scope ActionForm.
-Ted.
Hi,
I have been looking at this problem for the last four days and can't figure out. I have an application that required workflow form. I created a CreateUserAccountAction class that extends the DispatchAction and a form MultiCreateUserAccountForm that extends the ValidatorForm. The reset method of the MultiCreateUserAccountForm clears all attributes under the current session when the getPage() is equal to 2. The CreateUserAccountAction has two methods that are similar to the execute method that are named createUserAccountActionOne and createUserAccountActionTwo. I got this concept out of chapter 12 of the book Profession Jakarta Struts by James Goodwill and Richard Hightower.
*********************** Here are the symptoms ********************** If there is a required field that is missing (leaved out) or does not fulfill the validation rule on the firstPage.jsp when the submit button is pressed. A new dialog box popped up on the screen with the validation message(s) from the resource property file. When all fields are validated the control is forwarded to the secondPage.jsp.
If there is a required field that is missing (leaved out) or does not fulfill the validation rule on the secondPage.jsp when the submit button is pressed. A blank page is showed up on the window without a new dialog box shows up on the screen. The server.log indicates an error occurred and the control returns to the same page (secondPage.jsp). To fixing this problem, I pressed the back page button of the browser and correctly filled in all missing fields or making sure the input is conforming to the validation rule. When all fields on the second page are filled in correctly according to the validation rules then the control is correctly forwarded back to the firstPage.jsp.
************** My questions************************
Any suggestion and how to fix this problem is deeply appriciated.
Kam Lung Leung
*** ******* More detail on how the jsp was set up ******
The createUserAccountActionOne method calls the
MultiCreateUserAccountForm.validate() method to validate the user input fields of
the firstPage.jsp. Second, it calls the setPage() method with "1" as its input
parameter. Finally, it calls the MultiCreateUserAccountForm.setMethodToDispatch()
with "createUserAccountActionTwo" as the input parameter.
The createUserAccountActionTwo method calls the
MultiCreateUserAccountForm.validate() method to validate the user input fields of
the secondPage.jsp. Secondly, it remove the obsolete form bean with
session.removeAttribute(mapping.getAttribute()). Thirdly, it calls the setPage()
method with "2" as its input parameter. Finally, it calls the reset() method to
clear all attributes under the current session.
****** This are action mapping *********** <action path="/multiCreateUserAccountFirstSubmit" type="com.wlwa.CreateUserAccountAction" name="multiCreateUserAccountForm" scope="session" validate="true" parameter="methodToDispatch" input="/CreateUserAccountLink.jsp"> <forward name="success" path="/CreateUserAccountSecondLink.jsp" /> </action>
<action path="/multiCreateUserAccountSecondSubmit" type="com.wlwa.CreateUserAccountAction" name="multiCreateUserAccountForm" scope="session" validate="true" parameter="methodToDispatch" input="/CreateUserAccountSecondLink.jsp"> <forward name="success" path="/CreateUserAccountLink.jsp" /> </action>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Ted Husted, Junit in Action - <http://www.manning.com/massol/>, Struts in Action - <http://husted.com/struts/book.html>, JSP Site Design - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]