2 u011408745 u011408745 于 2014.03.11 17:27 提问

The requested resource (/StrutsTest/struts.action) is not available.

1、struts.xml-----------------------------------------------------
<?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">



welcome.jsp
error.jsp


2、web.xml---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>


struts

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter


struts
/*

3、index.jsp---------------------------------------------------------------
<%@ page language="java" pageEncoding="UTF-8"%>


struts2简单应用


<%@taglib uri="/struts-tags" prefix="s" %>

/s:textfield
/s:submit
/s:form

4、StrutsAction.java------------------------------------------------------------
package action;
import java.util.Map;

public class StrutsAction{
private String name;

public String getName(){
    return name;
}
public void setName(String name){
    this.name=name;
}
public String execute()throws Exception{
    if(name.equals("aa")){
        return "success";
    }else{
        return "error";
    }
}

}

5、------------------------------------------------------------------------
目录结构如下,由于不能截图,请您耐心点看,谢谢
StrutsTest
src
action
StrutsAction.java
struts.xml
WebRoot
WEB-INF
lib<包含导入的struts2的jar包>
web.xml
error.jsp
hello.jsp
index.jsp
welcome.jsp

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!