JSP 为啥总是遇到这样的错误

zhao9302 2008-07-25 12:12:08
HTTP Status 404 - /%E7%BD%91%E4%B8%8A%E5%95%86%E5%9F%8E/TestJSP.jsp

--------------------------------------------------------------------------------

type Status report

message /%E7%BD%91%E4%B8%8A%E5%95%86%E5%9F%8E/TestJSP.jsp

description The requested resource (/%E7%BD%91%E4%B8%8A%E5%95%86%E5%9F%8E/TestJSP.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.16
...全文
133 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhao9302 2008-07-26
  • 打赏
  • 举报
回复
问题解决了 谢谢呀 是我自己一些地方弄错了。。
zhao9302 2008-07-26
  • 打赏
  • 举报
回复
我知道路径不对呀 但是我都不知道是从哪里下手 去修改这个路径 按上面说的 我把中文的都改正过来了
zhao9302 2008-07-25
  • 打赏
  • 举报
回复
我那个需要到哪里进行设置呢 ?
xiangxiangping 2008-07-25
  • 打赏
  • 举报
回复
是jsp页面路径不正确
zhao9302 2008-07-25
  • 打赏
  • 举报
回复
<%@ page language="java" contentType="text/html; charset=gbk"
pageEncoding="gbk"%>

<%@ page import = "java.sql.*" %>
<%@ page errorpage = "" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>注册登陆系统首页</title>
</head>

<%
String UserId = (String)session.getAttribute("user");
if(UserId == null || UserId == "")
response.sendRedirect("login.jsp");
String productName = "";
float price = 0;
String description = "";

Connection conn = null;
Statement stmt = null;
ResultSet rs = null;

try
{
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/shoppingonline?user=root&password=admin";
conn = DriverManager.getConnection(url);
stmt = conn.createStatement();
String sql = "select * from products";
rs = stmt.executeQuery(sql);
}
catch(SQLException e)
{
e.printStackTrace();
}
%>


<body>

<table width = "%80", align = "center">
<tr>
<td >  用户登陆系统==<span >产品展示</span>==</td>
<td style = "width : 150; height: 20; vertical-align: middle; text-align:
center;">
<%= UserId %>  您好    
<a href = "login.jsp">登陆</a>   
<a href = "logout.jsp">注销</a>
</td>

</table>
<hr align = "center" width = "%75" color ="#990000" size =1/>
<table width = "%80" align = "center">
<tr>
<td height = "5" colspan = "2"></td>
</tr>
<%
while(rs.next())
{
productName = rs.getString("Product_name");
price = rs.getFloat("Price");
description = rs.getString("Description");
%>
<tr>
<td> 产品名称<%= productName %></td>
<td> 产品报价<%= price %></td>
</tr>
<tr>
<td colspan = "2"> 产品描述<%= description %></td>
</tr>
<tr>
<td height = "5" colspan = "2"><hr size = "3" width = "%10"/></td>
</tr>

<%
}
%>
</table>

<div align = "center" >2008==本公司版权所有</div>

</body>
</html>
zhao9302 2008-07-25
  • 打赏
  • 举报
回复
路径??额 建一个Dynamic Web Progect哪里要设置路径 我好像感觉没有要设置的地方 我的那个出问题的JSP程序是从书上抄下来的,里面没有涉及到路径啊 不能运行
天外流星 2008-07-25
  • 打赏
  • 举报
回复
没找到请求的页面,404错误是你的路径出了问题,好好检查一下那里的路径写错啦
天外流星 2008-07-25
  • 打赏
  • 举报
回复
参考一下:
http错误代码含义:
"100" : Continue
"101" : witching Protocols
"200" : OK
"201" : Created
"202" : Accepted
"203" : Non-Authoritative Information
"204" : No Content
"205" : Reset Content
"206" : Partial Content
"300" : Multiple Choices
"301" : Moved Permanently
"302" : Found
"303" : See Other
"304" : Not Modified
"305" : Use Proxy
"307" : Temporary Redirect
"400" : Bad Request
"401" : Unauthorized
"402" : Payment Required
"403" : Forbidden
"404" : Not Found
"405" : Method Not Allowed
"406" : Not Acceptable
"407" : Proxy Authentication Required
"408" : Request Time-out
"409" : Conflict
"410" : Gone
"411" : Length Required
"412" : Precondition Failed
"413" : Request Entity Too Large
"414" : Request-URI Too Large
"415" : Unsupported Media Type
"416" : Requested range not satisfiable
"417" : Expectation Failed
"500" : Internal Server Error
"501" : Not Implemented
"502" : Bad Gateway
"503" : Service Unavailable
"504" : Gateway Time-out
"505" : HTTP Version not supported


hemaily 2008-07-25
  • 打赏
  • 举报
回复
404 明显的路径不正确
zhao9302 2008-07-25
  • 打赏
  • 举报
回复
楼上说的很对 现在又出现了一个新问题 郁闷 。。。 刚学 一点头绪都摸不到。。


HTTP Status 404 - /ShoppingOnline/login.jsp

--------------------------------------------------------------------------------

type Status report

message /ShoppingOnline/login.jsp

description The requested resource (/ShoppingOnline/login.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.16



我的login.jsp 是存在的。。
yanrabbit163 2008-07-25
  • 打赏
  • 举报
回复
采用了中文的路径名,改成英文的,而且一定注意区分大小写
sony89757 2008-07-25
  • 打赏
  • 举报
回复
这个问题我也遇到过,我现在加了一个群,这个群人气较好,也的确有高手,不但可以交流问题,而且还可以接项目赚钱,QQ群号是:陆\肆\柒\玖\捌\柒\伍\伍,不要说我做广告,看看便知,如需要的话加入试试,如果你发现好的交流群也别忘了告诉我啊!呵呵!
j67884159 2008-07-25
  • 打赏
  • 举报
回复
/%E7%BD%91%E4%B8%8A%E5%95%86%E5%9F%8E/TestJSP.jsp
红色部分是你工程根路径。我不知这是乱码还是你设置成这样。
你可一发布起来,在浏览器的地址栏中手动输入你根路径+/TestJSP.jsp试试能否访问。
cuixiuqin1954 2008-07-25
  • 打赏
  • 举报
回复
1.你建的若是中文的项目名换成英文的!
2.你用什么发布的?
3.404说明你的路径没有找到,重新部署,发布就可以了
小雨转晴 2008-07-25
  • 打赏
  • 举报
回复
资源为找到
mark
zhj92lxs 2008-07-25
  • 打赏
  • 举报
回复
难道建的是中文项目名
farfromcross 2008-07-25
  • 打赏
  • 举报
回复
<%@ page errorpage = "" %>

改为

<%@ page errorPage = "" %>
zhao9302 2008-07-25
  • 打赏
  • 举报
回复
恩恩 果然是中文名字导致的错误。 那我现在 又报错了 。。 500 服务器错误。。。?

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

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

exception

org.apache.jasper.JasperException: /index.jsp(5,0) Page directive has invalid attribute: errorpage
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:311)
org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:106)
org.apache.jasper.compiler.Node$PageDirective.accept(Node.java:590)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Validator.validate(Validator.java:1700)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:165)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.


--------------------------------------------------------------------------------

67,541

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧