Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getReader()

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Fellas,

I found shocking to learn something like this in one of the final mocks..

it said HttpServletRequest.getReader() can be used to get the parameters passed from a form...

So far i have header only about getParameter...

Can somebody please clarify the difference and suggest whether there are any other ways for the same cause..
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
HttpServletRequest.getReader() returns the body of the request as a BufferedReader,with the characters encoded in the encoding specified in the request, while the getParameter will get value of the requested parameter as a String or return null of no such parameter exists.
Hope this sheds some light on your issue.

Allen.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can read the body of the request during an HTTP POST and parse the encoded parameters yourself, or let the request instance do it for you.

Unless you have a good reason to do it yourself, such as in a multi-part request, it's best to just use getParameter and its related methods.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Theepan Thevathasan:

it said HttpServletRequest.getReader() can be used to get the parameters passed from a form...



Get reader will give you a reader to the content that is there in the body of the HTTP request.In case of form with method=POST , the content are part of body of the HTTP request ,not URL.
 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi buddies...

Great...

I will definitely not go wrong if i get it for the exam....

all the credits to the fellow ranchers.....

until i post a new question, bye
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic