Derek Lin wrote:

What is the setPage() method? From what class?

Are you trying to do a form wizard(multiple pages using one
DynaValidatorForm)?

Yes. This is it exactly.

If so, I have something like that. But I had to
override the reset() method in DynaValidatorForm class.--I am still not sure
if this is the most elegant way. (don't have time to investigate further)

Let me know if I should post my code.

-- Derek

In struts-config.xml I have:

<form-beans>
<form-bean
name="dynaRegistrationForm"
dynamic="true"
type="org.apache.struts.validator.DynaValidatorForm">
.
.
.
<form-property name="page" type="int"/>
.
.
.
</form-bean>
</form-beans>

And in the jsp's I have the typical hidden field:
.
.
.
<html:form method="GET" action="/action/register">
<html:hidden property="page" value="2"/>
.
.
.

But the page will not validate correctly unless I call explicitly the setPage method for the DynaValidatorForm in the Action class, like so:

DynaValidatorForm info = (DynaValidatorForm) form;
int foof = -1;
try{
foof = Integer.parseInt(request.getParameter("page"));
info.setPage(foof);
}catch(Exception e){
if(!(e instanceof java.lang.NoSuchMethodException))
log.error(e.getMessage(),e);
}

ActionErrors errors = info.validate(mapping, request);


If I do not put the above in the Action code, the info.getPage() always returns zero, so the page is not validated since I have no page=0 in the appropriate places in validation.xml. With the above the first page gets validated correctly but the second also tries to validate every field that has page=2 in validation.xml AND page=1 too, which all fail since those parameters are not being submitted. It is almost like it is "forgetting" that they were set on the first page. Perhaps the trouble is that the DynaValidatorForm is not being saved in the session? I should not have to do this myself. Right? If you have this working, then by all means post your code.


Thanks a bunch!


--
Seth Milder
Department of Physics and Astronomy
MS 3f3
George Mason University
Fairfax, VA
http://www.mrseth.org
--
Sex alleviates tension. Love causes it. -- Woody Allen


--
To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to