David,<br />SCJP - 94% (2002-7-6)
42
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
David,<br />SCJP - 94% (2002-7-6)
David,<br />SCJP - 94% (2002-7-6)
Originally posted by David Li:
I have log all the message and I have log the following two methods:
System.out.println(request.getHeader("Referer"));
System.out.println(request.getParameter("nic"));
...
This is very curious here: Why the getHeader() method can get the full url with parameters, but getParameter() can't get the parameter?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
David,<br />SCJP - 94% (2002-7-6)
David,<br />SCJP - 94% (2002-7-6)
David,<br />SCJP - 94% (2002-7-6)
David,<br />SCJP - 94% (2002-7-6)
David,<br />SCJP - 94% (2002-7-6)
Dumitru
David,<br />SCJP - 94% (2002-7-6)
//pd1.jsp
<form action="pd2.jsp" method="post">
<input type="hidden" name="nic" value="hello">
<input type="text" name="sex" value="male">
<input type="submit">
</form>
After user click submit button, this is the process jsp:
//pd2.jsp
<%
System.out.println(request.getHeader("Referer"));
System.out.println(request.getParameter("nic"));
System.out.println(request.getParameter("sex"));
%>
The log message is:
/pd.jsp?nic=hello&sex=male
null
null
Originally posted by Oleg Kirillov:
I guess problem is here:
<form action="pd2.jsp" method="post">
You set method to "post", not "POST". The size, i.e. case does matter! If you try to look at http traffic you'll notice that really your browser used a GET method on this form as it parsed method attribute incorrectly.
Consider Paul's rocket mass heater. |