| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 703 人关注过本帖
标题:高手请帮帮我
只看楼主 加入收藏
hxm2005
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2005-8-11
收藏
 问题点数:0 回复次数:9 
高手请帮帮我

刚开使学习struts遇到问题,郁闷,谁能帮我看看。做一个简单的小例子,报的错误是,谁能帮我看看:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.index_jsp._jspService(index_jsp.java:96)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:711)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:188)
org.apache.jsp.index_jsp._jspx_meth_html_html_0(index_jsp.java:130)
org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

搜索更多相关主题的帖子: collection message request 
2007-01-09 10:57
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
收藏
得分:0 
贴代码,不然怎么告诉你哪写错了!

老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2007-01-09 11:15
hxm2005
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2005-8-11
收藏
得分:0 

页面:
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>

<html:html locale="true">
<head>
<title>logon</title>
<html:base/>
</head>
<body>
<h2>please login in</h2><p>
<html:errors/><p>
<html:form action="index.do">
your name:
<html:text property="userName" size="16" maxlength="16"/><br>
your password:
<html:password property="passWord" size="16" maxlength="16"/><br>
<html:submit property="submit" value="Submit"/>
<html:reset/>
</html:form><br>
<html:img page="/struts-power.gif" alt="Powered by Struts"/>
</body>
</html:html>
=====================================================================================
config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<!--
This is the Struts configuration file for the "Hello!" sample application
-->

<struts-config>

<!-- ======== Form Bean Definitions =================================== -->
<form-beans>
<form-bean name="LiziForm" type="web.form.LiziForm"/>
</form-beans>

<!-- ========== Action Mapping Definitions ============================== -->
<global-forwards>
<forward name="index" path="/index.jsp"/>
</global-forwards>
<action-mappings>
<!-- Say Hello! -->
<action path = "/index"
type = "web.action.LiziAction"
name = "LiziForm"
scope = "request"
validate = "true"
input = "/index.jsp"
>
<forward name="success" path="/index.jsp" />
<forward name="failure" path="/fanhui.jsp" />
</action>
</action-mappings>

<!-- ========== Message Resources Definitions =========================== -->

<message-resources parameter="logon.application"/>

</struts-config>

2007-01-09 12:57
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
收藏
得分:0 
LiziForm呢?

老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2007-01-09 13:33
hxm2005
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2005-8-11
收藏
得分:0 

LiziForm是:

package web.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;

/**
* @author Administrator
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class LiziForm extends ActionForm{
private String userName=null;
private String passWord=null;
public String getUserName(){
return userName;
}
public void setUserName(String userName){
this.userName=userName;
}
public String getPassWord(){
return passWord;
}
public void setPassWord(String passWord){
this.passWord=passWord;
}
public void reset(ActionMapping mapping,HttpServletRequest request){
this.userName=null;
this.passWord=null;
}
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request){
ActionErrors errors=new ActionErrors();
if((userName==null)||(userName.length()<1)||(passWord==null)||passWord.length()<1)
errors.add("userName",new ActionMessage("no"));
return errors;
}
}
==============================================================================================================
action是:

2007-01-09 13:49
hxm2005
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2005-8-11
收藏
得分:0 

加我QQ啊,交流方便点373572418

2007-01-09 13:52
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
收藏
得分:0 
....

[此贴子已经被作者于2007-1-9 16:22:13编辑过]



老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2007-01-09 14:32
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
收藏
得分:0 
以下是引用hxm2005在2007-1-9 13:52:30的发言:

加我QQ啊,交流方便点373572418

我的公司没法聊天...


老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2007-01-09 14:33
hxm2005
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2005-8-11
收藏
得分:0 
现在页面进去了,就是不能执行action
2007-01-09 15:50
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
收藏
得分:0 
action代码贴下

老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2007-01-09 16:23
快速回复:高手请帮帮我
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017148 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved