You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard Hightower <rh...@arc-mind.com> on 2004/01/14 18:08:14 UTC

low priority question about html:form

I assert the following:
"You could override the ActionForm associated with this <html:form/> by
using the scope and type attribute. The scope specifies where to look for
the ActionForm, and the type specifies what type of ActionForm it is, i.e.,
the fully qualified Java classname. This technique is not used in practice
very often, but it is good to know that it exists."

Example,

<html:form action="/myaction" scope="request" type="arcmind.MyForm"/>

I've thought of a few reasons why you want to do this, but they seemed
fairly lame. Can someone give me a valid use case where you would need this
feature?

QUESTION: Why not just specify the Form in the action mapping?


The <html:form /> tag renders an HTML form. The <html:form/> is associated
with an action mapping by the action attribute. The action attribute
specifies the path of the action mapping.  Therefore, when the user submits
the form the action associated with the ActionMapping will be invoked (if
the form is valid). It is interesting that this tag inspect the
ActionMapping and finds the ActionForm associated with the ActionMapping.
If the ActionForm is in scope, the property values of the ActionForm will be
rendered as the values in the HTML form field of the <html:form/>.  In fact
if the ActionMapping has an error (e.g., points to in valid ActionForm), the
page with the <html:form/> will never display until you fix the
ActionMapping.


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


RE: low priority question about html:form

Posted by Richard Hightower <rh...@arc-mind.com>.
Oppsss

the code listig should read:

<html:form action="/myaction" scope="request" type="arcmind.MyForm"
name="myform"/>


-----Original Message-----
From: Richard Hightower [mailto:rhightower@arc-mind.com]
Sent: Wednesday, January 14, 2004 10:08 AM
To: Struts Users Mailing List
Subject: low priority question about html:form



I assert the following:
"You could override the ActionForm associated with this <html:form/> by
using the scope and type attribute. The scope specifies where to look for
the ActionForm, and the type specifies what type of ActionForm it is, i.e.,
the fully qualified Java classname. This technique is not used in practice
very often, but it is good to know that it exists."

Example,

<html:form action="/myaction" scope="request" type="arcmind.MyForm"/>

I've thought of a few reasons why you want to do this, but they seemed
fairly lame. Can someone give me a valid use case where you would need this
feature?

QUESTION: Why not just specify the Form in the action mapping?


The <html:form /> tag renders an HTML form. The <html:form/> is associated
with an action mapping by the action attribute. The action attribute
specifies the path of the action mapping.  Therefore, when the user submits
the form the action associated with the ActionMapping will be invoked (if
the form is valid). It is interesting that this tag inspect the
ActionMapping and finds the ActionForm associated with the ActionMapping.
If the ActionForm is in scope, the property values of the ActionForm will be
rendered as the values in the HTML form field of the <html:form/>.  In fact
if the ActionMapping has an error (e.g., points to in valid ActionForm), the
page with the <html:form/> will never display until you fix the
ActionMapping.


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


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