So there I was, minding my own business, when I used the following Java syntax in of my servlets:
String userParam = request.getParameter("user");
I usually test the value to see if it is null to determine if the parameter even exists, as the servlet takes on differing behavior dependin开发者_如何学运维g on the presence of certain parameter names. Much to my chagrin, it appears the parameter "user" is already defined and is never null (prolly thanks to my app using a Tomcat Realm for its security), so I had to pick another name.
That all said, is there a list of system defined values for request.getParameter() for Tomcat 7?
EDIT: Sorry I wasn't clearer - I am looking for a docwise answer, without having to look at the source code. If a parameter exists, what are its possible values, and why?
You can call request.getParameterNames()
and get all such names. Make sure to call this when you have no explicit parameters being sent, so you'll see the ones that the server is setting up for you.
精彩评论