首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

求大哥帮帮忙!Cannot find ActionMappings or ActionFormBeans collection,该如何解决

2012-02-13 
求大哥帮帮忙!Cannot find ActionMappings or ActionFormBeans collection昨天初学struts,跟着网上下载的

求大哥帮帮忙!Cannot find ActionMappings or ActionFormBeans collection
昨天初学struts,跟着网上下载的一些视频教程学着做,就出现了这样的异常:Cannot   find   ActionMappings   or   ActionFormBeans   collection   昨晚也在CSND论坛找到了很多关于这个问题的解决方法。
自己也跟着做了检查,当然也有的说是版本的问题。昨天开始学用eclipse   用的是FullStack_MyEclipse5.1.0GA_E3.2.1版本+j2sdk1.4.2_11+jakarta-tomcat-5.0.28,请问这个配置可以运行struts1.2吗?
出现的问题:1.说是端口8080被占用,然后我就把conf\server.xml里的
<Connector   port= "8080 "   maxThreads= "150 "   minSpareThreads= "25 "   maxSpareThreads= "75 "   enableLookups= "false "   redirectPort= "8443 "   acceptCount= "100 "debug= "0 "   connectionTimeout= "20000 "   disableUploadTimeout= "true "   />
改成8383。请问是这样该吗?
2.运行comcat后,会出现:
严重:Begin   event   threw   exception
严重:Parsing   error   processing   resource   path   /WEB-INF/struts-config.xml
这样的错误。
在server.xml做了 <Context   path= "/first "   docBase= "E:\myworkspace\strutsfirst\WebRoot "   reloadable= "true "/> 的配置
说明:WebRoot\WEB-INF\lib已经有8个struts相关的包
/*     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>

/***********web.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>

/************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;
}
}

/**************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>
求大哥们帮我看看!急的睡不着!!小弟在此真诚的拜谢!


[解决办法]
不知道 帮顶 放心 会有高手帮忙解决的
[解决办法]
我遇到80端口被占用 失去计算机服务那里把 TOMCAT从自动改成禁用了,好像也是手动 再重起一次 我是这样解决的
[解决办法]
1. 的确是这样改,顺便说句,如果你的8080端口本来没有程序用,查看一下你是不是启动了两次Tomcat。
2. 你的web.xml怎么跟struts-config.xml一个样?
[解决办法]
顶下,我的tomcat也出现这样的情况晕死。

热点排行