My first thought was you could use the 'action' to identify the form bean
and the 'href' to specify a certain url to submit the form to.  

But then I looked at the JSTL <c:url> tag and it seems that a better
algorithm would be to prepend the context path only when the 'action' begins
with a slash ("/").  This seems better, and here's how it would work:

<html:form action="login.do">
        would become
<FORM ACTION="login.do">

and 

<html:form action="/login"> or <html:form action="/login.do">
        would become
<FORM ACTION="/myApp/login.do">
        or 
<FORM ACTION="/myApp/module/login.do">
        as appropriate

Perhaps if this were the right behavior, we would add a 'contextRelative'
attribute to allow a form to be submitted across modules as with
ActionForward.


-JT


-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@;apache.org]
Sent: Monday, October 28, 2002 11:13 AM
To: Struts Developers List
Subject: Re: [SURVEY] HREF attribute for FormTag




On Mon, 28 Oct 2002, Taylor, Jason wrote:

> Date: Mon, 28 Oct 2002 10:38:21 -0800
> From: "Taylor, Jason" <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: 'Struts Developers List' <[EMAIL PROTECTED]>
> Subject: [SURVEY] HREF attribute for FormTag
>
> Hi all--
>
> There have been two bugs (#12600, #13871) logged against the form tag for
> the behavior of its getActionMappingUrl method, which always prepends the
> context path.
>
> Other html tags that produce a URL that is sent to the browser such as
> LinkTag and ImgTag give the user at least the option of specifying
precisely
> the URL sent, but FormTag does not.  See bug #12600 for an example of an
> architecture where this could be a problem, or consider the case of
someone
> building a Struts application that submits a form to a third party for
> processing, which just occurred to me as another test case.
>
> Does anyone oppose the idea of adding an 'href' attribute to FormTag,
along
> the lines of the 'href' attribute possessed by the LinkTag, that can be
used
> instead of the 'action' to determine where the form is submitted?  If so,
do
> you have an alternative that allows me to prevent the context path from
> being prepended?  If not, I'd be happy to submit a patch.
>

One of the things you'd give up when doing this is the ability of Struts
to identify the associated form bean.  Therefore, it seems like this would
only be of use in constructing a form to be submitted to a non-Struts app
-- and, for that, you can just use a normal HTML <form> element directly.
Am I missing something?

> -JT
>

Craig


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

Reply via email to