struts2下配置出错,麻烦找下错误
HTTP状态404 - / sturts01/day01/list
类型状态报告
消息 / sturts01/day01/show
说明 请求的资源(/ sturts01/day01/show)不可用。
Original text
HTTP Status 404 - /sturts01/day01/show
Contribute a better translation
的Apache Tomcat/6.0.30
--------------------位于src下的struts.xml
<struts>
<package name="demo1" extends="struts-default" namespace="/day01" >
<action name="show" class="service/ActionServlet">
<result name="success">
/WEB-INF/jsp/show.jsp
</result>
</action>
</struts>
---------lib下的xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>Struts01</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Struts01</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
----WEB-INF下面的js文件夹里的show.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h2>欢迎.........</h2>
</body>
</html>
------service包下的ActionServlet(控制器)
package service;
import entity.Project;
public class ActionServlet {
public String execute(){
return "success";
}
}
访问地址http://localhost:8080/sturts01/day01/list后报404.。。。。
------解决方案--------------------
路径问题,你看下你的地址栏路径和页面的真是路径是否一致...