You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Canos <da...@gmail.com> on 2009/06/02 18:35:08 UTC

Remove .action from forms action attribute

Hi folks

I'm using Struts 2.1.6 (not convention) and URLRewrite filter.I'm trying to
remove .action extension from a form's action attribute.

A simple tag like this:
<s:form id="crearWhere" theme="simple" action="../where/create"
name="crearWhere">

it's rendered as:
<form id="crearWhere" name="crearWhere" action="/MyProject/../where/*
create.action*" method="post">

I need to tidy this uri removing ".action" from action-attribute.

http://struts.apache.org/2.1.6/docs/form.html says
If the action is given and is not an action alias defined in struts.xml,
Struts will used the action attribute as if it is the posting url, separting
the namespace from it and using UrlHelper to generate the final url.

This is my case, so, I suppose I should config UrlHelper to build my own
URL, but I got nothing about it.
Thanks in advance

Re: Remove .action from forms action attribute

Posted by David Canos <da...@gmail.com>.
I prefer to render the real path I type.

2009/6/2 Dave Newton <ne...@yahoo.com>

> David Canos wrote:
>
>> Now we have got to remove the suffix, any idea about the preffix
>> /MyProject/../?
>>
>
> Don't you want the form to submit to your application?
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Remove .action from forms action attribute

Posted by Dave Newton <ne...@yahoo.com>.
David Canos wrote:
> Now we have got to remove the suffix, any idea about the preffix
> /MyProject/../?

Don't you want the form to submit to your application?

Dave

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


Re: Remove .action from forms action attribute

Posted by David Canos <da...@gmail.com>.
Hi Wes, than you very much for your reply, now .action doesn't appear as
suffix.
Is possible to update the documentation with this info, it will help lot of
people.

Now we have got to remove the suffix, any idea about the preffix
/MyProject/../?
*
*

2009/6/2 Wes Wannemacher <we...@wantii.com>

> With 2.1.6, w/o any major modifications of configuration, the URLs can
> lack the '.action' by default. It seems that s:url and s:form will
> render urls with the .action suffix, if the page rendering the tag was
> requested with the suffix. Try visiting the page rendering the form
> w/o specifying the .action suffix.
>
> -Wes
>
> On Tue, Jun 2, 2009 at 12:35 PM, David Canos <da...@gmail.com> wrote:
> > Hi folks
> >
> > I'm using Struts 2.1.6 (not convention) and URLRewrite filter.I'm trying
> to
> > remove .action extension from a form's action attribute.
> >
> > A simple tag like this:
> > <s:form id="crearWhere" theme="simple" action="../where/create"
> > name="crearWhere">
> >
> > it's rendered as:
> > <form id="crearWhere" name="crearWhere" action="/MyProject/../where/*
> > create.action*" method="post">
> >
> > I need to tidy this uri removing ".action" from action-attribute.
> >
> > http://struts.apache.org/2.1.6/docs/form.html says
> > If the action is given and is not an action alias defined in struts.xml,
> > Struts will used the action attribute as if it is the posting url,
> separting
> > the namespace from it and using UrlHelper to generate the final url.
> >
> > This is my case, so, I suppose I should config UrlHelper to build my own
> > URL, but I got nothing about it.
> > Thanks in advance
> >
>
>
>
> --
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Remove .action from forms action attribute

Posted by Wes Wannemacher <we...@wantii.com>.
With 2.1.6, w/o any major modifications of configuration, the URLs can
lack the '.action' by default. It seems that s:url and s:form will
render urls with the .action suffix, if the page rendering the tag was
requested with the suffix. Try visiting the page rendering the form
w/o specifying the .action suffix.

-Wes

On Tue, Jun 2, 2009 at 12:35 PM, David Canos <da...@gmail.com> wrote:
> Hi folks
>
> I'm using Struts 2.1.6 (not convention) and URLRewrite filter.I'm trying to
> remove .action extension from a form's action attribute.
>
> A simple tag like this:
> <s:form id="crearWhere" theme="simple" action="../where/create"
> name="crearWhere">
>
> it's rendered as:
> <form id="crearWhere" name="crearWhere" action="/MyProject/../where/*
> create.action*" method="post">
>
> I need to tidy this uri removing ".action" from action-attribute.
>
> http://struts.apache.org/2.1.6/docs/form.html says
> If the action is given and is not an action alias defined in struts.xml,
> Struts will used the action attribute as if it is the posting url, separting
> the namespace from it and using UrlHelper to generate the final url.
>
> This is my case, so, I suppose I should config UrlHelper to build my own
> URL, but I got nothing about it.
> Thanks in advance
>



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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