I am hoping this is an easy question. I am not well versed in Java, I am a ITSM admin, but the ITSM product we use comes with Tomcat as it's web server. I am trying to find out if there is a simple way to set index file (welcome page) of a tomcat site to check for the requestURL() and redirect to certain URL's based on the requestURL().

Long story short I am trying to setup my site like this:

(my tomact server is setup to receive requests on two different hostnames)

If end users reaches my page by going to http://myspecificURL1 then redirect to http://myspecificURL1/mycontext

OR

if end user reached my page by going to http://myspecificURL2 then redirect to http://myspecificURL2/specificlandingpage

I searched for conditional redirects before posting this, but none really addressed what I am trying to do. If anyone can shed some light or kindly point me in the right direction, I may be able save what hair I haven't pulled out yet.

Thanks

in order to redirect in jsp you can use the following code

response.sendRedirect(redirectURL)

Here redirectURL is the url, you need to forward

please find the following link for the complete example

JSP Redirect Example

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.