0

I have created a dynamic web project in Java. When I run the project with Tomcat server, it always hits index.html. I want to hit index.html in home folder, and then I write redirection to it on this way:

<meta HTTP-EQUIV="REFRESH" content="0; url=../home/">

and a lot of other combination, but it always returns 404 not found. Does anyone have ideas how I could start page /home/index.html?
web.xml always hits the page in WebContent Folder

Here is how it looks.

enter image description here

2
  • Why do you put static content inside src folder? Commented Dec 19, 2013 at 10:03
  • I thought that static content also can be in src folder. @mauretto Commented Dec 19, 2013 at 12:03

2 Answers 2

1

Write below code in your web.xml under tag.

<welcome-file-list>
   <welcome-file>/home/index.html</welcome-file>
</welcome-file-list>
Sign up to request clarification or add additional context in comments.

1 Comment

I have tried that already, but web.xml again hits index.html in WebContent folder. @Rahul Sahu
0

It looks like your src folder does not contain sources but just static resources. You should avoid putting your css/html/images/js in this folder. Put all these in WebContent/css, WebContent/home, WebContent/images and WebContent/js and everything should work the right way.

2 Comments

I already use this solution, but i am interested why redirection doesn't work.
Things in src folder are not supposed to go to your application root directory but to WEB-INF/classes which is unreachable from a browser. That's why you HAVE to put your static resources in the WebContent directory like my answer mention and NOT in src.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.