• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 - /Ch03/

 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am debugging a simple JSP example but I failed.
J2ee 1.4;j2se 6;Tomcat 6.0.10


Here is the directory structure


url http://localhost:80/Ch03
welcome.jsp



web.xml in C:\apache-tomcat-6.0.10\webapps\ROOT\WEB-INF\Ch03\WEB-INF

I have spent three days still not figured it out.
Could you please help me?
Thanks for any hint.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you putting a web app inside the WEB-INF of another web app?

Place your web app in the webapps folder.
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I place it in
It is still wrong.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DON'T put it in the WEB-INF folder.

Put it in webapps.
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is placed in
Still wrong.
Is my web.xml right?
Or classpath wrong?

Thanks
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you class file is not in a package,
you jsp page import Ch3.*;
but the class file in WEB-INF/class doesnt have a CH3 folder
make sure you use package for all you class
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this.
Go to our CodeBarn, click to the servlets section, download SimpleServlet.war to your webapps directory.
Then, go to http://localhost:8080/SimpleServlet.

If that works, then you have a properly formatted web application with a deployment descriptor.

You can compare this to your application and see where you might have gone wrong.
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Souther's servlet does work.
But I still get the error

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.



or

welcome.jsp

Thanks again.
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change
<%@ page errorPage="/WEB-INF/errorPage.jsp"
import="java.util.Iterator,Ch03.FaqCategories" %>

to
<%@ page errorPage="/WEB-INF/errorPage.jsp" %>
<%@ page import="java.util.Iterator,Ch03.FaqCategories" %>

try not add any business logic in your jsp, good design only uses JSp as a presentation layer.
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for youe help, I have resloved it. Just change two lines

to

one line.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic