0 Replies Latest reply on Apr 25, 2002 10:19 PM by Erik Sliman

    Get host name from JSP/Servlet

    Erik Sliman Apprentice

      How do you get the host name used to invoke a JSP/servlet?

      What I am trying to do is access another JSP on the same site, and output the results of that JSP to a file as part of a caching procedure.

      I am able to get the results of a JSP using the stream from a URL with the host hardcoded, but I don't want to hard code the URL into a stream. The host/context is going to always be the same as that used to invoke the currently running servlet/JSP.

      The RequestDispatcher would work, IF it allowed you to capture and direct the output of the include() method. I don't know why someone decided to only let us send the output to the servlet output stream. In my use case, I need to cache the output to a file.