How to make Struts2 action take only POST request

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to make Struts2 action take only POST request

tatan123
How to make Struts2 action take only POST request. Is there any way like spring controller , acceptable HTTP method. We only want submit to happen by post and no GET request should be allowed
Reply | Threaded
Open this post in threaded view
|

Re: How to make Struts2 action take only POST request

Kumar Mettu
Nilay,

  As you can see Attributes for action from:
   http://struts.apache.org/dtds/struts-2.0.dtd
  There is no configuration that would let you do that. However you can do this programatically by using ServletActionContext.getRequest().getMethod()

Hope this helps.

Kumar.

--- On Fri, 3/27/09, tatan123 <[hidden email]> wrote:

From: tatan123 <[hidden email]>
Subject: How to make Struts2 action take only POST request
To: [hidden email]
Date: Friday, March 27, 2009, 9:21 PM


How to make Struts2 action take only POST request. Is there any way like
spring controller , acceptable HTTP method. We only want submit to happen by
post and no GET request should be allowed
--
View this message in context: http://www.nabble.com/How-to-make-Struts2-action-take-only-POST-request-tp22753654p22753654.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]




Reply | Threaded
Open this post in threaded view
|

Re: How to make Struts2 action take only POST request

tatan123
Thank you for the info. It will be good like the spring controller, if the we can declaratively configure a Struts Action to take HTTP method...

Kumar Mettu wrote
Nilay,

  As you can see Attributes for action from:
   http://struts.apache.org/dtds/struts-2.0.dtd
  There is no configuration that would let you do that. However you can do this programatically by using ServletActionContext.getRequest().getMethod()

Hope this helps.

Kumar.

--- On Fri, 3/27/09, tatan123 <nilay.bose@gmail.com> wrote:

From: tatan123 <nilay.bose@gmail.com>
Subject: How to make Struts2 action take only POST request
To: user@struts.apache.org
Date: Friday, March 27, 2009, 9:21 PM


How to make Struts2 action take only POST request. Is there any way like
spring controller , acceptable HTTP method. We only want submit to happen by
post and no GET request should be allowed
--
View this message in context: http://www.nabble.com/How-to-make-Struts2-action-take-only-POST-request-tp22753654p22753654.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Reply | Threaded
Open this post in threaded view
|

Re: How to make Struts2 action take only POST request

Paweł Wielgus
In reply to this post by Kumar Mettu
Hi all,
You can also try to do it in interceptor, i have written a little post
about how to intercept all Your actions here:

http://poulwiel.blogspot.com/2009/01/intercepting-all-actions-inside-my-app.html

then in interceptor You can allow only POST rquests to be served.


Best greetings,
Pawel Wielgus

2009/3/28, Kumar Mettu <[hidden email]>:

> Nilay,
>
>   As you can see Attributes for action from:
>    http://struts.apache.org/dtds/struts-2.0.dtd
>   There is no configuration that would let you do that. However you can do
> this programatically by using ServletActionContext.getRequest().getMethod()
>
> Hope this helps.
>
> Kumar.
>
> --- On Fri, 3/27/09, tatan123 <[hidden email]> wrote:
>
> From: tatan123 <[hidden email]>
> Subject: How to make Struts2 action take only POST request
> To: [hidden email]
> Date: Friday, March 27, 2009, 9:21 PM
>
>
> How to make Struts2 action take only POST request. Is there any way like
> spring controller , acceptable HTTP method. We only want submit to happen by
> post and no GET request should be allowed
> --
> View this message in context:
> http://www.nabble.com/How-to-make-Struts2-action-take-only-POST-request-tp22753654p22753654.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]