f



get a value in the servlet with get, but null with post

Hi,

I am getting a value for a hidden field in my servlet when the method
of the form is GET.
But when I change it to POST, I get a null value for the same field,
all things remaining the same.

Does anybody have any idea why this could be happening?

Thanks,
Shiv
0
ss_panda (1)
10/10/2003 10:32:03 PM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

3 Replies
624 Views

Similar Articles

[PageSpeed] 8

"Shiv" <ss_panda@hotmail.com> wrote in message
> Does anybody have any idea why this could be happening?

Not without seeing some code...

-- 
Wendy in Chandler, AZ


0
wendywds (324)
10/10/2003 11:08:47 PM
try to find article named "High-Level Network Programming ", here is one
part:
"....
Consider the following HTML form:

                       <form
action="http://www.javacourses.com/servlets/getMarks method="GET">
                       Student#:
                       <input type=text name=number size=30>
                       <input type=submit name=GetMarks value=GetMarks>
                       </form>

                       This form is handled by the servlet
http://www.javacourses.com/servlet/getMarks. The form uses
                       the GET method to transfer the information. When
the user enters a student number -- such as 556677 --
                       and clicks the GetMarks button, the form data is
sent to the servlet as part of the URL. The encoded URL
                       is:
http://www.javacourses.com/servlets/getMarks?number=556677.

                       In the case of POST, however, input data is not
sent as part of the URL; rather, it is sent as an entity body
                       in a separate message. Therefore, the POST method
is more secure, and you can send more data with it. In
                       addition, the data doesn't have to be in plain
text, as with the GET method.
.....

"
hope this helps...

Shiv wrote:

> Hi,
>
> I am getting a value for a hidden field in my servlet when the method
> of the form is GET.
> But when I change it to POST, I get a null value for the same field,
> all things remaining the same.
>
> Does anybody have any idea why this could be happening?
>
> Thanks,
> Shiv

0
cwele (10)
10/11/2003 5:53:36 PM
Shiv wrote:
> I am getting a value for a hidden field in my servlet when the method
> of the form is GET.
> But when I change it to POST, I get a null value for the same field,
> all things remaining the same.
> 
> Does anybody have any idea why this could be happening?

I'll make two wild guesses:

(1) the servlet is using custom code to parse the request's query 
string, instead of using ServletRequest's parameter retrieval methods.

(2) the servlet is opening a stream from the request's body with 
getInputStream() or getReader() before it tries to obtain the parameters.

If neither of those is it then we'll have to see some code.


John Bollinger
jobollin@indiana.edu

0
jobollin (1557)
10/13/2003 1:58:02 PM
Reply: