my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes getParameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "getParameter" Watch "getParameter" New topic
Author

getParameter

Sangita Hota
Greenhorn

Joined: Jul 03, 2006
Posts: 7
In Mikalai notes under getParameter(String name) method it says:
If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream() or getReader() can interfere with the execution of this method.

What does this mean?
Kiaama Liames
Ranch Hand

Joined: Jun 30, 2006
Posts: 52
The following line is from the servlet API documentation

According to the API getReader()

Retrieves the body of the request as character data using a BufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method or getInputStream() may be called to read the body, not both.

and for getInputStream()

Retrieves the body of the request as binary data using a ServletInputStream. Either this method or getReader() may be called to read the body, not both.

In case the parameters are sent using a POST request i.e as part of the request body when you use getParameter() along with getReader()/getInputStream() then you might not get the expected result this is what it means i am not quite sure about the exact reason, the API also states that getReader() and getInputStream() cannot not used simultaneously to read the request body


scjp 1.4<br />scwcd 1.4
cheenu Dev
Ranch Hand

Joined: Nov 13, 2005
Posts: 276
i have a baseline doubt in these ques..
except for getInputStream
are the other methods in 1.4 exam?
they didnt turn up in hfsj...


cheenujunk@gmail.com
 
 
subject: getParameter