HTTP Status 404怎么解决?

cloudphoenix 2012-06-24 07:27:21
这个示例的web.xml太简单了,完全和网上的对不上号啊……

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- 配置Spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
WEB-INF/classes/com/us/jack/config/applicationContext.xml
WEB-INF/classes/com/us/jack/config/applicationContext-services.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>


<!-- 配置Struts2 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

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


求各位帮忙了。另外这个示例的index.jsp文件有两个,分别属于user文件夹和sbook文件夹。这样做没问题吗?
...全文
2650 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
laotouliulei 2012-06-25
  • 打赏
  • 举报
回复
将index.jsp放在应用程序根目录下。
或者:
如果user文件夹放在应用程序根目录下,则
<welcome-file-list>
<welcome-file>/user/index.jsp</welcome-file>
</welcome-file-list>
如果sbook文件夹放在应用程序的web-inf目录下,则

<welcome-file-list>
<welcome-file>/sbook/index.jsp</welcome-file>
</welcome-file-list>
Everliang 2012-06-25
  • 打赏
  • 举报
回复
呵呵,像楼主的配置文件,index.jsp前面什么路径都没有,默认指向的是WebContent文件下的index.jsp文件
authorzhh 2012-06-25
  • 打赏
  • 举报
回复
“404” 太简单了,你不会百度?

你没看到 csdn都经常在说 “404你懂的”

404大家都懂,lz要找对学习方法,要学会自己解决问题。

你不觉得百度 比bbs等人回答更快捷吗?
hardsonxu 2012-06-25
  • 打赏
  • 举报
回复
将index.jsp放在应用程序根目录下。
或者:
如果user文件夹放在应用程序根目录下,则
<welcome-file-list>
<welcome-file>/user/index.jsp</welcome-file>
</welcome-file-list>
如果user文件夹放在应用程序的web-inf目录下,则

<welcome-file-list>
<welcome-file>/WEB-INF/user/index.jsp</welcome-file>
</welcome-file-list>
似梦飞花 2012-06-25
  • 打赏
  • 举报
回复
你得指定是哪个文件夹下的index吧 貌似?
cloudphoenix 2012-06-25
  • 打赏
  • 举报
回复
另外 我的index.jsp调用addBook.jsp也是HTTP Status 404。我改了路径也是这样,我有哪些地方没注意吗?
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>图书管理页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>

<body>
<a href="/sbook/addBook.jsp">添加图书</a>
<a href="viewSBook.action">浏览图书</a>
<a href="../user/">用户登录</a>
</body>
</html>
cloudphoenix 2012-06-25
  • 打赏
  • 举报
回复
我也是看了网上很多东西才来问的。这个改路径的方法我前几天试过,当时是没有成功,可能有些东西没有注意把。

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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