新手,使用tomcat6、mysql5、myeclipse8.5、struts2开发项目,用http://localhost:8080/courses打不开首页。
项目名称:courses,使用tomcat6、mysql5、myeclipse8.5、struts2,页面错误提示:
HTTP Status 404 - /courses/
type Status report
message /courses/
description The requested resource (/courses/) is not available.
Apache Tomcat/6.0.35
struts.xml如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.i18n.encoding" value="gb2312"></constant>
<constant name="struts.custom.i18n.resources" value="message"></constant>
<package name="my" extends="struts-default">
<action name="student_*" class="it.cast.action.StudentAction" method="{1}">
<result name="login">/pages/studentcourse/course.jsp</result>
<result name="list">/pages/delete/studentdelete.jsp</result>
<result name="list1">/pages/query/studentlist2.jsp</result>
<result name="list3">/pages/query/studentlist.jsp</result>
<result name="updateBySno">/pages/update/updatestudent.jsp</result>
<result name="selectedlist">/pages/query/courselisted.jsp</result>
<result name="delete">/pages/delete/student_delete_success.jsp</result>
<result name="error">/fail.jsp</result>
<result name="no_login_error">/pages/insert/course_select_fail.jsp</result>
<result name="select_error">/pages/insert/course_select_fail.jsp</result>
<result name="selected_error">/pages/insert/course_selected_fail.jsp</result>
<result name="login_error">/index/login_fail.jsp</result>
<result name="update">/pages/query/student_success.jsp</result>
<result name="select">/pages/insert/course_select_success.jsp</result>
<result name="logout">/pages/studentcourse/course.jsp</result>
<result name="input">/index/index.jsp</result>
</action>
</package>
</struts>
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">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
index.jsp代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>高校学生选课系统</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />