This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
what do you mean, request has a parameter 'username' with some value ..
i guess you mean to say if there was a parameter in query string with the name 'userName' having some value, the code u provided would replace its value of userName to 'Prabhu' for login.jsp forward standard only and if not exsist would create one and set the mentioned value?
Originally posted by Reshma Pai: prabhu, i guess you mean to say if there was a parameter in query string with the name 'userName' having some value...
Just to add here that its not compulsory to have request parameters in query string only.
What if post method is used to submit the parameters to a resource?
Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Joined: Sep 17, 2002
To my knowledge using POST method should not make difference regarding the parameters submitted to the server program.
Using GET method, the query string is visible in the browser bar while with POST its not.
Joined: Aug 28, 2005
The parameters that are sent to the server through post method, are they called query String?
I am talking about something off topic. I just wanted to say that if there was a parameter, not just in query string but also in payload, then even its value would get replaced by new value.
I Was just elaborating the sentance:
i guess you mean to say if there was a parameter in query string with the name 'userName' having some value...
The parameter values either in payload or query string are not replaced by the values specified in the <jsp aram>. The values are still avilable there. Only the values specified in <jsp aram> take preferenece to the old parameter values. When you use getParameter on the request object, it return the first value which is specified by the <jsp aram>. The request parameters can have multiple values. You can access all values using getPrarameterValues() method, which return arrary of string of values.
The parameter values specified in the <jsp aram> are applicable for the given forward or include tag.