You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steve Sether <ss...@usenergyservices.com> on 2007/08/17 16:29:15 UTC

Re: [S2] (action on form outside of struts2)

If I specify the entire URL with http:// (etc) it works fine, but that 
causes other problems for testing and whatnot that I'd like to avoid by 
using relative URLs.  I haven't tried ../notation, but I'll try it as a 
workaround.

It just seems like there should be a way to specify a URL in the action 
parameter and not have it be modified by Struts.

yitzle wrote:
> On 8/16/07, Steve Sether <ss...@usenergyservices.com> wrote:
>> I'm using struts 2 to create a form whose action links outside of struts
>> 2. The problem is when I set the action parameter in the <s:form tag,
>> the framework is putting the Struts2 context in the URL. For instance:
>> say I have a struts 2 project called struts2.war, and another project
>> called myProject.war.
>>
>> <s:form action="/myProject/processForm">
>> ...
>> </s:form>
>>
>> will create a <form action="/struts2/myProject/processForm">
>> instead of
>> <form action="/myProject/processForm"> like I want.
>>
>> I've tried to use a literal like: <s:form
>> action="'/myProject/processForm'", and even the "recommended" syntax of
>> %{'/myProject/processForm'}.
>>
>> "'/myProject/processForm'" results in action="'myProject/processForm'"
>>
>> while
>> %{'/myProject/processForm'}
>>
>> results in
>> action="/struts2/myProject/processForm"
>>
>> One way around this is of course to just use the raw <form> tag of html.
>>   It seems like it should be possible to use the Struts 2 tag here and
>> be able to gain it's benefits (though obviously not server side validations)
>>
> 
> Can you specify the entire URL? Or try doing
> "../myProject/processForm" or "../../myProject/processForm" or
> whatever.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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


Re: [S2] (action on form outside of struts2)

Posted by Steve Sether <ss...@usenergyservices.com>.
To anyone who's interested in a workaround to my issue, I wound up 
creating an action that does a redirect to a URL passed into the action, 
and re-constructing the query string from the passed in parameters. 
It's not an elegant solution, but it does work.

Steve Sether wrote:
> If I specify the entire URL with http:// (etc) it works fine, but that 
> causes other problems for testing and whatnot that I'd like to avoid by 
> using relative URLs.  I haven't tried ../notation, but I'll try it as a 
> workaround.
> 
> It just seems like there should be a way to specify a URL in the action 
> parameter and not have it be modified by Struts.
> 
> yitzle wrote:
>> On 8/16/07, Steve Sether <ss...@usenergyservices.com> wrote:
>>> I'm using struts 2 to create a form whose action links outside of struts
>>> 2. The problem is when I set the action parameter in the <s:form tag,
>>> the framework is putting the Struts2 context in the URL. For instance:
>>> say I have a struts 2 project called struts2.war, and another project
>>> called myProject.war.
>>>
>>> <s:form action="/myProject/processForm">
>>> ...
>>> </s:form>
>>>
>>> will create a <form action="/struts2/myProject/processForm">
>>> instead of
>>> <form action="/myProject/processForm"> like I want.
>>>
>>> I've tried to use a literal like: <s:form
>>> action="'/myProject/processForm'", and even the "recommended" syntax of
>>> %{'/myProject/processForm'}.
>>>
>>> "'/myProject/processForm'" results in action="'myProject/processForm'"
>>>
>>> while
>>> %{'/myProject/processForm'}
>>>
>>> results in
>>> action="/struts2/myProject/processForm"
>>>
>>> One way around this is of course to just use the raw <form> tag of html.
>>>   It seems like it should be possible to use the Struts 2 tag here and
>>> be able to gain it's benefits (though obviously not server side 
>>> validations)
>>>
>>
>> Can you specify the entire URL? Or try doing
>> "../myProject/processForm" or "../../myProject/processForm" or
>> whatever.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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