当前位置: 代码迷 >> Java Web开发 >> 刚学JSP。运行不了。求救ing
  详细解决方案

刚学JSP。运行不了。求救ing

热度:199   发布时间:2008-06-12 07:52:59.0
刚学JSP。运行不了。求救ing
在命令提示符里。HELLOWORLD输出成功,然后,我参照教程上写了一个JSP的文件(first.jsp)http://127.0.0.1:8080/myapp/first.jsp 出现这样的错误:
HTTP Status 404 - /myapp/first.jsp

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

type Status report

message /myapp/first.jsp

description The requested resource (/myapp/first.jsp) is not available.


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

Apache Tomcat/5.5.9
这个错误怎样解决?谢了,,这有可能是环境配置的问题吗?请大家多多指教。

[[it] 本帖最后由 zalem 于 2008-6-12 07:54 编辑 [/it]]

[[it] 本帖最后由 zalem 于 2008-6-12 07:55 编辑 [/it]]
搜索更多相关主题的帖子: JSP  ing  first  myapp  jsp  

----------------解决方案--------------------------------------------------------
可能是你的路径有问题吧!
你将你的那个first.jsp放到tomcat文件下的webapps这个文件里 再试试!
----------------解决方案--------------------------------------------------------
你的web.xml要修改一下
检查一下你的web.xml

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>


这个地方改成first.jsp。或者把first.jsp改成index.jsp
----------------解决方案--------------------------------------------------------
还是不行。
first.jsp的代码如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%
Class.forName
("org.gjt.mm.mysql.Driver").newInstance();
String url="jdbc:mysql:
//localhost/softforum?user=
soft&password=soft1234&useUnicode=
true&characterEncoding=8859_1"
//first为你的数据库名
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sql="select * from first";
Resultset rs=stmt.executeQuery(sql);
while(rs.next()){%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜您")%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
是不是代码有错误呢?
----------------解决方案--------------------------------------------------------
Statement stmt=conn.createStatement();
----------------解决方案--------------------------------------------------------
还是不行。。不知什么问题,很急啦。。谢谢各位帮手啦。。~~
----------------解决方案--------------------------------------------------------
404的意思是找不到文件.
----------------解决方案--------------------------------------------------------
请教一下楼上的。。可以详细说明一下吗?  谢了
----------------解决方案--------------------------------------------------------
就是说,/myapp/first.jsp,这个路径不对,找不到该文件
----------------解决方案--------------------------------------------------------
请教搭建JSP平台,JSP+TOMACT+MYSQL
如果搭建JSP平台,可以详细说明一下吗?谢谢~~
----------------解决方案--------------------------------------------------------
  相关解决方案