This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes LocalHost in request.serverName() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "LocalHost in request.serverName() " Watch "LocalHost in request.serverName() " New topic
Author

LocalHost in request.serverName()

Nitin Raodeo
Greenhorn

Joined: Jul 27, 2002
Posts: 21
I have my Web application on Tomcat server(without Apache).
The IP is mapped to some DSN.
In my JSP when i fetch the name of the server(request.serverName() )
it is displayed it as LocalHost and not the server name.
Does any configuration need to be done?
Thanks in Advance.


1) SCJP 1.4<br />2) SCBCD (EJB 2.0)<br />3) IBM WebSphere Portal<br />4) WSAD (exam 287)
Ken Robinson
Ranch Hand

Joined: Dec 23, 2003
Posts: 101
I believe this is web container specific. Each web container usually has it's own config file (catalina.xml I believe for Tomcat) that allows configuration of vendor specific properties. Most likely, localhost is configured in this file as the server name. Try playing with it and switching to the IP of the machine instead.
I'm not sure this will work, but I've had a similar problem with the host URL/name in the container I'm using and it was a vendor specific issue.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LocalHost in request.serverName()