Another point is you don't need to cast DynaValidatorForm in your action, DynaActionForm will do or even DynaBean.
When the action servlet see's that validate = true the validate() method is called and errors returned to the view before the action is run. If you have a look at some of the struts 1.0 examples with validation methods in them and then see when validator came onto the screen it starts making sense. On explanation of action forms was that they act like a "fire wall " between the view and the action, whether "fire wall" was the best description is debatable but it worked for me at the time.
On 26 Feb 2004, at 09:59, RALPH ROPER wrote:
hi,
I have changed a DynaActionForm to a DynaValidatorForm. The DynaActionForm
email property (the only property on the form) was being displayed in a new
popup window. Since I changed to a DynaValidator form it shows the value as
blank. I have the Javascript validation working OK.
The flow of events is as follows
1. User clicks on Request Email button on main window
2. ShowEmailAction is called that populates emailAddress property. (I have
confirmed value is put into form).
3. Pops up new window and shows show_email.jsp. The emailAddress property is
blank.
struts-config.xml <form-bean name="EmailForm" type="org.apache.struts.validator.DynaValidatorForm"> <form-property name="emailAddress" type="java.lang.String" /> </form-bean>
<action path="/enquiry/showEmail"
type="com.cuscal.mmdd.action.cuenquiry.ShowEmailAction" name="EmailForm"
scope="session" input="/enquiry/showEmail.do" validate="false">
<forward name="success"
path="com/cuscal/mmdd/jsp/cu_enquiry/show_email.jsp"/>
</action>
ShowEmailAction public class ShowEmailAction extends MMDDirectBaseAction {
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
// logger.debug("Entered ShowEmailAction method"); System.out.println("Entered ShowEmailAction method");
UserView user = getUserContainer(request).getUserView(); String email = user.getEmail(); DynaValidatorForm emailForm = (DynaValidatorForm) form; // DynaActionForm emailForm = (DynaActionForm) form; emailForm.set("emailAddress", email); System.out.println("@@@email=" + emailForm.get("emailAddress")); // This bit works return mapping.findForward("success"); }
}
show_email.jsp
< ...... tags, validator javascript, etc ....... >
<html:html>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<link href=<html:rewrite
href='/MMDDirectWeb/com/cuscal/mmdd/jsp/cu_enquiry/styles/ styles00.css' />
rel="stylesheet" type="text/css" />
<TITLE>email.jsp</TITLE>
</HEAD>
<BODY>
<P><strong>Verify Email Address</strong></P>
<html:javascript formName="EmailForm" />
<p>Please check/correct/add the email address below where the member's list
will be sent</p>
<html:form action="/enquiry/email.do" onsubmit="return
validateEmailForm(this);">
<!-- <bean:define name="EmailForm" property="emailAddress"
id="ea" type="java.lang.String" /> -->
<html:text property="emailAddress" size="35"/><br/>
<div align="right"><p></p>
<a href="#" class="button1"
onClick="window.close();">Cancel</a>
<!-- <html:link href="../enquiry/email.do"
styleClass="button1">Submit link</html:link> -->
<!-- <html:link action="/enquiry/email.do"
styleClass="button1">Submit</html:link> -->
<html:submit
styleClass="button">Submit</html:submit>
</div>
</html:form>
</BODY>
</html:html>
So close yet so far. Thanks for any assistance.
regards,
Ralph Roper Business Technology Services (BTS) Credit Union Services
________________________________________________________
NOTICE
The information in this email and or any of the attachments may contain;
a. Confidential information of Credit Union Services Corporation (Australia) Limited (CUSCAL) or third parties; and or
b. Legally privileged information of CUSCAL or third parties; and or
c. Copyright material of CUSCAL or third parties.
If you are not an authorised recipient of this email, please contact CUSCAL immediately by return email or by telephone on 61-2-8299 9000 and delete the email from your system.
We do not accept any liability in connection with computer virus, data corruption, interruption or any damage generally as a result of transmission of this email.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]