Redirect with Tomcat

Hi all,

I have a question. I have not been able to find an answer to this online.

I have a site running. First it loads index.jsp from ROOT directory. So when you navigate to www.asdf.com it loads ROOT/index.jsp. From this page there are links that take the user to webapps/MYAPP..... Now I want to have the following. When a user navigates to www.asdf.com it takes him directly to webapps/MYAPP...

How can I achieve this? Modify server.xml?

Thank you.

[484 byte] By [CSGuya] at [2007-11-27 7:46:38]
# 1

That is HTML and/or JavaScript functions. Pure HTML does that from something like

<body onLoad = "redirect()">

<script language = "JavaScript">

function redirect()

{

// Redirecting code

// I can't really recall exact syntax. Find out.

}

</script>

</body>

Jamwaa at 2007-7-12 19:27:35 > top of Java-index,Java Essentials,Java Programming...
# 2
yes, it is possible to do it this way. However, this is not the best way to handle any client side code. The best is to achieve this in server configuration side. This is what I am looking for. Thanks for you advice though.
CSGuya at 2007-7-12 19:27:35 > top of Java-index,Java Essentials,Java Programming...
# 3
any ideas?Thanks.
CSGuya at 2007-7-12 19:27:35 > top of Java-index,Java Essentials,Java Programming...
# 4
> How can I achieve this? Modify server.xml?web.xml, actually: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/WebApp4.html#wp85892
kdgregorya at 2007-7-12 19:27:35 > top of Java-index,Java Essentials,Java Programming...
# 5

You can use forward(), getting the servlet context of your second web-app and the requestDispatcher from there. You can find other servlet context objects from any one. However you'll have the wrong URI in the request and this is likely to complicate the picture when the new page is displayed.

malcolmmca at 2007-7-12 19:27:35 > top of Java-index,Java Essentials,Java Programming...
# 6

Oh, didn't realize that you wanted to set a default app for the case where people don't put in the context. Yes, you can do that to, and as you suspected, by modifying server.xml: http://tomcat.apache.org/tomcat-4.0-doc/config/context.html

You will probably also want to set the welcome page in your web.xml, although I thing the default looks for index.jsp.

kdgregorya at 2007-7-12 19:27:35 > top of Java-index,Java Essentials,Java Programming...
# 7
Yes, default is index.jsp.Thanks for the links, I will look into this.I'd rather do it somewhere in settings instead of doing coding.THanks.
CSGuya at 2007-7-12 19:27:35 > top of Java-index,Java Essentials,Java Programming...