You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Wellie W. Chao" <wc...@caraveltech.com> on 2002/04/13 16:57:29 UTC

Struts design question re: form action

I'm just curious about a design issue with Struts 1.1. The <html:link/> tag
has a "forward" attribute that lets you specify an entry from
struts-config.xml as the destination of the link. That way you aren't tied
to a particular action or a particular JSP/HTML page. Why isn't there a
similar attribute for <html:form/>? You have to directly specify the URI
(using the "action" attribute) instead of being able to specify a forward
mapping. It just seemed inconsistent to me.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Struts design question re: form action

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sat, 13 Apr 2002, Wellie W. Chao wrote:

> Date: Sat, 13 Apr 2002 10:57:29 -0400
> From: Wellie W. Chao <wc...@caraveltech.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: Struts design question re: form action
>
> I'm just curious about a design issue with Struts 1.1. The <html:link/> tag
> has a "forward" attribute that lets you specify an entry from
> struts-config.xml as the destination of the link. That way you aren't tied
> to a particular action or a particular JSP/HTML page. Why isn't there a
> similar attribute for <html:form/>? You have to directly specify the URI
> (using the "action" attribute) instead of being able to specify a forward
> mapping. It just seemed inconsistent to me.

A couple of reasons:

* The "action" parameter (which is used to specify the <action> you want)
  is already a logical indirection; the name of a bunch of business logic
  that you want to execute ("save customer") without knowing anything
  about the actual Action class that implements this logic.  It would be
  redundant to provide two different logical indirection schemes.

* Using a forward parameter instead of an action name would mean that the
  page has no way to infer what form bean to use, so you'd essentially
  have to give up all the fancy support provided for form beans.

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>