求救--Cannot find ActionMappings or ActionFormBeans collection

07-07-17 fly168
好久没来这里,记得上次在论坛里看到一个高手推荐这里,说实话,被banq老师和各位老师的严谨,认真态度打动了,看着老师们所讨论的问题,很多领域我都看不懂,在北京的日子目前的确不好过,两个月没找到工作,为了能在这个行业发展,自己跑到北大青鸟培训,本以为自己现在能写点东西而有点自豪,本以为这样应该就可以找到自己比较理想的工作,可是入门却太难,有时候还真挺灰心的,不过坚持下去才能走出来的道理我还是明白,没工作的压力让我两边都有点顾不上,挺迷茫,花了不少钱去培训,可是现在学到的,在这里看来就不是什么东西,上次就被一个查询分页的问题,让我憋了快两星期,才解决,前天开始学习struts,跟着网上下的一些视频教程,跟着做,可是会有错误,在CSDN上也看到过不少类似的问题,跟着修改,可是还是得不到解决,请各位老师抽点时间帮小弟看看!在此拜谢了!
我用的是FullStack_MyEclipse5.1.0GA_E3.2.1+j2sdk1.4.2_11+jakarta-tomcat-5.0.28
问题:1.请问这个配置可以运行struts1.2吗?(看到有人说可能是版本不符合的原因)
2.运行comcat后,会出现:
严重:Begin event threw exception
严重:Parsing error processing resource path /WEB-INF/struts-config.xml
这样的错误。
说明:WebRoot\WEB-INF\lib已经有8个struts相关的包

fly168
2007-07-17 21:22
代码如下:
/************* struts-config.xml************* */

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
<data-sources />
<form-beans >
<form-bean name="loginForm" type="com.qingniao.wangwei.struts.form.LoginForm" />

</form-beans>

<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="loginForm"
input="/errors.jsp"
name="loginForm"
path="/login"
scope="request"
type="com.qingniao.wangwei.struts.action.LoginAction" >
<forward name="success" path="/success.jsp"></forward>
<forward name="failure" path="/failuer.jsp"></forward>
</action>

</action-mappings>

<message-resources parameter="com.qingniao.wangwei.struts.ApplicationResources" />
</struts-config>

fly168
2007-07-17 21:23
/************web.xml**************/
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>action<servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet<servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
<servlet>
<servlet-mapping>
<servlet-name>action<servlet-name>
<url-pattern>*.do</url-pattern>
<servlet-mapping>
</web-app>
/************LoginForm****************/

package com.qingniao.wangwei.struts.form;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
* MyEclipse Struts
* Creation date: 07-16-2007
*
* XDoclet definition:
* @struts.form name="loginForm"
*/
public class LoginForm extends ActionForm {
/*
* Generated fields
*/

/** password property */
private String password;

/** username property */
private String username;

/*
* Generated Methods
*/

/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors=new ActionErrors();
if(this.username==null||"".equals(this.username))
{
errors.add("name",new ActionMessage("username.null"));
}
if(this.password==null||"".equals(this.password))
{
errors.add("name",new ActionMessage("password.null"));
}
return errors;
}

/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}

/**
* Returns the password.
* @return String
*/
public String getPassword() {
return password;
}

/**
* Set the password.
* @param password The password to set
*/
public void setPassword(String password) {
this.password = password;
}

/**
* Returns the username.
* @return String
*/
public String getUsername() {
return username;
}

/**
* Set the username.
* @param username The username to set
*/
public void setUsername(String username) {
this.username = username;
}
}

fly168
2007-07-17 21:23
/**************LoginAction**************/

package com.qingniao.wangwei.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.qingniao.wangwei.struts.form.LoginForm;

/**
* MyEclipse Struts
* Creation date: 07-16-2007
*
* XDoclet definition:
* @struts.action path="/login" name="loginForm" input="/form/login.jsp" scope="request" validate="true"
*/
public class LoginAction extends Action {
/*
* Generated Methods
*/

/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
String username=loginForm.getUsername();
String password=loginForm.getPassword();
if("ww".equals(username)&&"ww".equals(password))
{
return mapping.findForward("success");
}
else
{
return mapping.findForward("failure");
}

}
}
/*************ApplicationResources.properties*******************/

# Resources for parameter 'com.qingniao.wangwei.struts.ApplicationResources'
# Project strutsfirst
username.null= <li> name is not null
password.null=<li> password is not null

/************JSP页面-login.jsp************/

<%@ page language="java" contentType="text/html;charset=GBK"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>


<html:html lang="true">
<head>

<title>login.jsp</title>

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<html:form action="/login" method="post">
用户名:<html:text property="username"></html:text><br/>
密码:<html:password property="password"></html:password><br/>
<html:submit value="登陆"></html:submit>
</html:form>
</body>
</html:html>