Distinguishing GET and POST paramaters in jsp

Discussion in 'Java' started by Vic, Jun 24, 2004.

  1. Vic

    Vic Guest

    Hi,

    Is there a better way to determine if a parameter came through
    as a POST parameter rather than a GET one? The only way I can
    see that you can do this is by examining the query string.

    Thanks,

    Vic
     
    Vic, Jun 24, 2004
    #1
    1. Advertising

  2. On 24 Jun 2004 05:49:10 -0700, Vic <> wrote:

    > Hi,
    >
    > Is there a better way to determine if a parameter came through
    > as a POST parameter rather than a GET one? The only way I can
    > see that you can do this is by examining the query string.
    >
    > Thanks,
    >
    > Vic


    From the servlet API, it looks like the HttpServletRequest
    method getRequestURL will do what you want. (I have not
    actually tried this)

    Bill


    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    William Brogden, Jun 24, 2004
    #2
    1. Advertising

  3. Vic

    Sudsy Guest

    William Brogden wrote:
    > On 24 Jun 2004 05:49:10 -0700, Vic <> wrote:
    >>
    >> Is there a better way to determine if a parameter came through
    >> as a POST parameter rather than a GET one? The only way I can
    >> see that you can do this is by examining the query string.

    >
    > From the servlet API, it looks like the HttpServletRequest
    > method getRequestURL will do what you want. (I have not
    > actually tried this)


    Even easier: HttpServletRequest#getMethod()
    Should return "GET", "POST" or "PUT".
     
    Sudsy, Jun 24, 2004
    #3
  4. Vic wrote:

    > Is there a better way to determine if a parameter came through
    > as a POST parameter rather than a GET one? The only way I can
    > see that you can do this is by examining the query string.


    If you're worried about POST requests containing parameters in both the
    query string and the request body then you must indeed examine the query
    string to sort it out. Otherwise, though, take Sudsy's advice and just
    check the request method.


    John Bollinger
     
    John C. Bollinger, Jun 24, 2004
    #4
  5. Vic

    Ben_ Guest

    What's the point ???

    "Vic" <> wrote in message
    news:...
    > Hi,
    >
    > Is there a better way to determine if a parameter came through
    > as a POST parameter rather than a GET one? The only way I can
    > see that you can do this is by examining the query string.
    >
    > Thanks,
    >
    > Vic
     
    Ben_, Jun 24, 2004
    #5
  6. Vic

    Luke Tulkas Guest

    "Ben_" <> wrote in message
    news:40db4a19$0$8992$...
    > What's the point ???


    The point is that http parameters can be transfered by more than one method:
    GET, POST, PUT. Sometimes it would be nice if server side knew how they were
    sent. Generaly the .getMethod() takes care of that. But... you can have
    method set to GET and send some parameters as the method suggests (as in
    after "?" part of an URI) and some as POST (written directly onto output
    stream of an http connection).

    > "Vic" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > Is there a better way to determine if a parameter came through
    > > as a POST parameter rather than a GET one? The only way I can
    > > see that you can do this is by examining the query string.
    > >
    > > Thanks,
    > >
    > > Vic

    >
    >
     
    Luke Tulkas, Jun 28, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M?rcia Elias
    Replies:
    4
    Views:
    409
    M?rcia Elias
    Jan 27, 2004
  2. Robert Mark Bram

    Paramaters in EL?

    Robert Mark Bram, Mar 20, 2005, in forum: Java
    Replies:
    2
    Views:
    414
    Chris Riesbeck
    Mar 21, 2005
  3. bjam
    Replies:
    2
    Views:
    399
  4. Michael Olea

    Design Problem: "Smart Paramaters"

    Michael Olea, Jun 6, 2005, in forum: C++
    Replies:
    5
    Views:
    387
    Michael Olea
    Jun 10, 2005
  5. mbowles
    Replies:
    0
    Views:
    504
    mbowles
    Jun 17, 2010
Loading...

Share This Page