------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
  <constant name="struts.devMode" value="true" />
 
<package name="default" namespace="/actions" extends="struts-default">       
        <action name="Student*" class="com.jiezongzhen.StudentAction" method="{1}">
            <result>/Student{1}_success.jsp </result>
        </action>
        <action name="*_*" class="com.jiezongzhen.{1}Action" method="{2}">
            <result>/{1}_{2}_success.jsp </result>
        </action>
    </package>
 
    <!-- Add packages here -->
</struts>
------------------------------------------------------------------------------------------------------------------
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
  </head>
  
  <body>
  <a href="actions/Studentadd_success">添加学生1</a>
  <br>
    <a href="actions/Student_add_success">添加学生</a>     <a href="actions/Student_delete_success">删除学生</a>
  </body>
</html>
-------------------------------------------------------------------------------------------------------------------package com.jiezongzhen;public class StudentAction {
public String add(){
return "success";
}
public String delete(){
return "success";
}
}
----------------------------------------------------------------------------------------------------------------

解决方案 »

  1.   

    java程序错了,自己定义的Action需要继承ActionSupport这个类
    public class StudentAction extends ActionSupport[/color] {
    public String add(){
    return "success";
    }
    public String delete(){
    return "success";
    }
    }
      

  2.   

    java程序错了,自己定义的Action需要继承ActionSupport这个类
    public class StudentAction extends ActionSupport {
    public String add(){
    return "success";
    }
    public String delete(){
    return "success";
    }
    }
      

  3.   

    默认继承了 ActionSupport 
    发下错误
      

  4.   

    1、删除
    <action name="Student*" class="com.jiezongzhen.StudentAction" method="{1}">
      <result>/Student{1}_success.jsp </result>
      </action>2、将JSP
    <a href="actions/Studentadd_success">添加学生1</a>
      <br>
      <a href="actions/Student_add_success">添加学生</a> <a href="actions/Student_delete_success">删除学生</a>改为:
    <a href="actions/Student_add_success">添加学生1</a>
      <br>
      <a href="actions/Student_add.action">添加学生</a> <a href="actions/Student_delete.action">删除学生</a>