Struts2为什么无法找到action啊?eclipse和myeclipse不一样吗?

来源:互联网 发布:域名注册使用godaddy 编辑:程序博客网 时间:2024/06/06 14:10

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%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>  </head>    <body>    This is my JSP page. <br>    <a href="ac">跳转action</a>  </body></html>

这是再简单不过的jsp页面了,我点击“跳转action”就提示404啊。

下面是配置和代码


<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN""http://struts.apache.org/dtds/struts-2.1.7.dtd"><struts>    <constant name="struts.configuration.xml.reload" value="true"></constant>        <package name="system" extends="strust-default" namespace="/">        <action name="ac" class="cn.itcast.elec.web.action.ElecTextAction" method="ac">        </action>       </package></struts>


package cn.itcast.elec.web.action;import com.opensymphony.xwork2.ActionSupport;import com.opensymphony.xwork2.ModelDriven;import cn.itcast.elec.web.form.ElecTextForm;public class ElecTextAction extends ActionSupport implements ModelDriven<ElecTextForm>{private ElecTextForm elecTextForm=new ElecTextForm();@Overridepublic ElecTextForm getModel() {// TODO Auto-generated method stubreturn elecTextForm;}public String ac(){System.out.println("ElecTextAction中ac方法执行了");return NONE;}}



0 0