String « Request « JSP-Servlet Q&A





1. Java: String representation of just the host, scheme, possibly port from servlet request    stackoverflow.com

I work with different servers and configurations. What is the best java code approach for getting the scheme://host:[port if it is not port 80]. Here is some code I have used, ...

2. How to get the request string including parameters    stackoverflow.com

I have an odd exception in our application and I'd like to log when it occurs and include the complete request string including the parameters. When I try

log.warn("Weird request " + ...

3. Why does "request.getUserPrincipal().getName()" sometimes return a blank string?    stackoverflow.com

Has somebody an idea, why the getName() method of the UserPrincipal sometimes provides an empty String? Most of the time it returns the correct user name but not every time. This behaviour ...

4. request.getQueryString() doesn't return the hash part of the query string    stackoverflow.com

I am using Java EE and request.getQueryString() doesn't return the #hash part

my/page?id=4#hash
I am using Struts 2. Is there any solution?

5. java jsp check the request parameter    stackoverflow.com

I want to do this in jsp

if(request.getParameter("page") == "page1")
// do something
else if(request.getParameter("page") == "page2")
// do something else
but it isn't working. The url seems correct /page.jsp?page=page1, and when I print out request.getParameter("page") ...

6. Request from jsp form gives null string value    coderanch.com

Hello I get" null" each time I type my name and send it to be processed. My first file is called form.jsp and the second is called processform.jsp. Why do I get the null for login name? I do not get this for location? I have just read that getParameter() is deprecated? could this be the problem? Welcome ...