struts常见错误

CAN总线故障类型及处理方式 CAN网络中的通信错误可能是由各种问题引起的。 阅读详情
Strus常见错误及原因分析
本篇文章包含了在用Struts开发web应用时经常碰到的一些异常和错误,根据异常或错误信息本身,经常可以找到潜在的错误发生原因。
下面列出了一些Struts的常见错误和异常,并给出了一些可能发生此类错误或异常的原因。有的后面有相关连接,你可以通过它找到更多的信息。

Cannot retrieve mapping for action

异常

javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login (/Login是你的action名字)

 

 

可能原因

action没有再struts-config.xml 中定义,或没有找到匹配的action,例如在JSP文件中使用 <html:form action="Login.do".将表单提交给Login.do处理,如果出现上述异常,请查看struts-config.xml中的定义部分,有时可能是打错了字符或者是某些不符合规则,可以使用struts console工具来检查。

 

Cannot retrieve definition for form bean null

异常

org.apache.jasper.JasperException: Cannot retrieve definition for form bean null

可能原因       
       

这个异常是因为Struts根据struts-config.xml中的mapping没有找到action期望的form bean。大部分的情况可能是因为在form-bean中设置的name属性和action中设置的name属性不匹配所致。换句话说,action和form都应该各自有一个name属性,并且要精确匹配,包括大小写。这个错误当没有name属性和action关联时也会发生,如果没有在action中指定name属性,那么就没有name属性和action相关联。当然当action制作某些控制时,譬如根据参数值跳转到相应的jsp页面,而不是处理表单数据,这是就不用name属性,这也是action的使用方法之一。

 

No action instance for path /xxxx could be created

异常

No action instance for path /xxxx could be created

可能原因

特别提示:因为有很多中情况会导致这个错误的发生,所以推荐大家调高你的web服务器的日志/调试级别,这样可以从更多的信息中看到潜在的、在试图创建action类时发生的错误,这个action类你已经在struts-config.xml中设置了关联(即添加了<action>标签)。

在struts-config.xml中通过action标签的class属性指定的action类不能被找到有很多种原因,例如:

  • 定位编译后的.class文件失败。Failure to place compiled .class file for the action in the classpath (在web开发中,class的的位置在r WEB-INF/classes,所以你的action class必须要在这个目录下。例如你的action类位于WEB-INF/classes/action/Login.class,那么在struts-config.xml中设置action的属性type时就是action.Login).
  • 拼写错误,这个也时有发生,并且不易找到,特别注意第一个字母的大小写和包的名称。

在struts-config.xml中指定的action类没有继承自Stuts的Action类,或者你自定义的Action类没有继承自Struts提供的Action类。

你的action类必须继承自Struts提供的Action类。

你的classpath的问题。例如web server没有发现你的资源文件,资源文件必须在WEB-INF/classes/目录下。

Problem in struts-config.xml file with action mapping.

Problem with data-sources.xml file.

相关链接

 

No getter method for property XXXX of bean org.apache.struts.taglib.html.BEAN

异常

javax.servlet.jsp.JspException: No getter method for property username of bean org.apache.struts.taglib.html.BEAN

可能原因

没有位form bean中的某个变量定义getter 方法

这个错误主要发生在表单提交的FormBean中,用struts标记<html:text property=”username”>时,在FormBean中必须有一个getUsername()方法。注意字母“U”。

Related Links

 

java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm

错误

java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm

可能原因

这个错误主要发生在在classpath中找不到相应的Java .class文件。如果这个错误发生在web应用程序的运行时,主要是因为指定的class文件不在web server的classpath中(/WEB-INF/classes 和 /WEB-INF/lib)。

在上面的错误中,原因是找不到ActionForm类。

This error is sometimes seen when one or more ActionForm.class instances are actually in the classpath. This most often occurs when ActionForm.class is made available correctly by placing struts.jar in the /WEB-INF/lib directory. When this library has been correctly placed and it is verified that ActionForm.class actually is present in the struts.jar file, the problem is either that more than one copy of ActionForm.class is in the classpath or (more likely) that duplicate versions of class files other than ActionForm are in the same classpath, causing confusion. This is especially true if a class that extends ActionForm is made available twice, such as in an .ear file that encompasses a .war file as well as in the .war file's own classpath (/WEB-INF/classes). This problem can be resolved by guaranteeing that there are no redundant classes, especially those related to Struts (directly from Struts or extensions of Struts), in the web application's view.

相关连接

 

Exception creating bean of class org.apache.struts.action.ActionForm: {1}

异常

javax.servlet.jsp.JspException: Exception creating bean of class org.apache.struts.action.ActionForm: {1}

可能原因

Instantiating Struts-provided ActionForm class directly instead of instantiating a class derived off ActionForm. This might occur implicitly if you specify that a form-bean is this Struts ActionForm class rather than specifying a child of this class for the form-bean.

Not associating an ActionForm-descended class with an action can also lead to this error.

Related Links

 

 

Cannot find ActionMappings or ActionFormBeans collection

Exception

javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection

可能原因

不是标识Struts actionServlet的<servlet>标记就是映射.do扩展名的<sevlet-mapping>标记或者两者都没有在web.xml中声明。

在struts-config.xml中的打字或者拼写错误也可导致这个异常的发生。例如缺少一个标记的关闭符号/>。最好使用struts console工具检查一下。

另外,load-on-startup必须在web.xml中声明,这要么是一个空标记,要么指定一个数值,这个数值用来表servlet运行的优先级,数值越大优先级越低。

还有一个和使用load-on-startup有关的是使用Struts预编译JSP文件时也可能导致这个异常。

相关链接

 

NullPointerException at ... RequestUtils.forwardURL

异常

java.lang.NullPointerException at org.apache.struts.util.RequestUtils.forwardURL(RequestUtils.java:1223)

可能原因

在struts-config.xml中的forward元素缺少path属性。例如应该是如下形式:
<forward name="userhome" path="/user/userhome.jsp"/>

 

Cannot find bean org.apache.struts.taglib.html.BEAN in any scope

Exception

javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope

 

 

Probable Causes

试图在Struts的form标记外使用form的子元素。这常常发生在你在</html:form>后面使用Struts的html标记。
另外要注意可能你不经意使用的无主体的标记,如<html:form … />,这样web 服务器解析时就当作一个无主体的标记,随后使用的所有<html>标记都被认为是在这个标记之外的,如又使用了<html:text property=”id”>
还有就是在使用taglib引入HTML标记库时,你使用的prefix的值不是html。 

相关连接

 

Missing message for key xx.xx.xx

Exception

javax.servlet.jsp.JspException: Missing message for key xx.xx.xx

Probable Causes

这个key的值对没有在资源文件ApplicationResources.properties中定义。如果你使用eclipse时经常碰到这样的情况,当项目重新编译时,eclipse会自动将classes目录下的资源文件删除。

资源文件ApplicationResources.properties 不在classpath中 应将资源文件放到 WEB-INF/classes 目录下,当然要在struts-config.xml中定义)

 

Cannot find message resources under key org.apache.struts.action.MESSAGE

异常

Cannot find message resources under key org.apache.struts.action.MESSAGE

可能原因

很显然,这个错误是发生在使用资源文件时,而Struts没有找到资源文件。

Implicitly trying to use message resources that are not available (such as using empty html:options tag instead of specifying the options in its body -- this assumes options are specified in ApplicationResources.properties file)

XML parser issues -- too many, too few, incorrect/incompatible versions

Related Links

 

No input attribute for mapping path /loginAction

错误

No input attribute for mapping path /xxxxAction

可能原因e

No input attribute in action mapping in struts-config.xml file for the action with the name specified in the error message. An input attribute is not required if form validation is not performed (either because the validate attribute is set to false or because the validation method in the relevant form class is not implemented. The input attribute specifies the page leading to this action because that page is used to display error messages from the form validation.

Related Links

 

 

Strange Output Characters

错误

Strange and seemingly random characters in HTML and on screen, but not in original JSP or servlet.

可能原因

混和使用Struts的html:form标记和标准的HTML标记不正确。

使用的编码样式在本页中不支持。

 

"Document contained no data" or no data rendered on page

错误

"Document contained no data" in Netscape

No data rendered (completely empty) page in Microsoft Internet Explorer

可能原因

使用一个Action的派生类而没有实现perform()方法或execute()方法。在Struts1.0中实现的是perform()方法,在Struts1.1中实现的是execute()方法,但Struts1.1向后兼容perform()方法。

但你使用Struts1.1创建一个Action的派生类,并且实现了execute()方法,而你在Struts1.0中运行的话,就会得到"Document contained no data" error message in Netscape or a completely empty (no HTML whatsoever) page rendered in Microsoft Internet Explorer.”的错误信息。

 
Struts2框架搭建实践与常见错误解析 Struts2是一个基于MVC模式的Web应用框架,它将Web层进行了解耦,简化了Java EE应用的开发。作为Apache软件基金会下的一个项目,Struts2主要负责控制层(Controller)的实现,与前端页面和后端数据处理分离,从而使得应用程序的维护变得更加容易。 阅读详情

相关推荐

modbus-esp8266库深度解析:工业级Modbus协议栈实现

Modbus是一种广泛应用于工业自动化领域的通用串行通信协议,其核心在于标准化的功能码、寄存器模型与帧结构设计。基于RTU、ASCII和TCP三种传输变体,Modbus协议通过主从架构实现设备间可靠数据交互,具备低开销、高兼容性与强实时性等技术价值。在边缘计算与工业物联网场景中,它被广泛用于PLC通信、传感器数据采集、HMI集成及远程固件升级(FOTA)等关键任务。针对ESP8266/ESP32等Wi-Fi微控制器平台,modbus-esp8266库提供了完整协议栈支持,涵盖多实例并发、回调驱动架构、零拷贝

weixin_42315569的博客 349

strus增删改查

strus增删改查

m0_54067126的博客 405

FPGA优质开源项目 – UDP万兆光纤以太网通信

本文开源一个FPGA项目:UDP万兆光通信。文章末尾有该工程源码获取方式,有需要的小伙伴可以点赞、分享支持一下~

cjx_csdn的博客 4766

[CAN] CAN BUS的错误检测和错误状态管理

错误检测 CAN控制器应提供以下错误检测机制。 总线监测(也就是通过收发器回环到RX PIN来监测总线电平) 位填充检查 帧格式检查 CRC校验 ACK检查 有五种错误类型,它们并不相互排斥(也就是可以同时出现)。 Bit error 位错误 Stuff error 填充错误 CRC error Form error ACK error Bit error 位错误 在总线上发送比特的节点也应监视总线。 当监视的位值与发送的位值不同时,认为检测到位错误。 例外:  在仲裁期间发送隐.

Lenz_s_law的开发记录本 2万+

Innovus时钟树综合CTS实战:从原理到signoff的完整指南

时钟树综合(CTS)是数字后端实现中保障同步电路时序收敛的核心环节,其本质是在物理层面构建低偏斜、可控延迟的全局时钟分发网络。它基于静态时序分析(STA)原理,通过平衡clock skew、insertion delay、transition time与功耗面积等多维约束,对抗工艺电压温度(PVT)变异带来的时序不确定性。技术价值在于支撑GHz级高频芯片的setup/hold签核,广泛应用于CPU、GPU、AI加速器等复杂SoC的Innovus后端流程。本文聚焦CTS在Innovus工具链中的工程落地,覆盖

weixin_28523493的博客 223

Oracle数据库RMAN异机恢复保姆级教程,按照步骤来操作,一次就成功!

本文深入解析RMAN异机恢复四大核心场景(演练、数据恢复、故障应急、测试环境搭建),提供从备份到验证的完整步骤和实战脚本。包含RAC到单机迁移技巧、路径调整、常见报错解决方案,助你彻底掌握数据库恢复的“救命技能”。DBA必备干货,强烈推荐

Jackyimi的博客 939

struts使用

1.struts配置 1.1在pom.xml导入struts与tomcat的jar依赖(在maven中默认没有tomcat) <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma

weixin_58670730的博客 688

保姆级教程:Win10/Win11系统下ArcGIS 10.2中文版完整安装与破解(含License Manager启动失败解决方案)

本文提供Windows 10/11系统下ArcGIS 10.2中文版的完整安装与破解教程,重点解决License Manager启动失败等常见问题。从安装准备、破解文件处理到最终配置验证,详细指导用户完成每一步操作,确保软件正常运行。特别针对主机名修改、端口占用等疑难问题提供专业解决方案。

weixin_29596051的博客 539

一文读懂CAN总线

前言 CAN总线的应用在现在看来越来越广泛,我厂设备从最初的ARM9与ARM7平台、期间升级过度到CortexA8与Cortex M3平台,再到现在的Cortex M4平台,围绕CAN进行了一系列产品的开发,CAN总线的稳定性是毋庸置疑的。 CAN总线物理结构与特性 CAN总线网络 CAN总线网络主要挂在CAN_H和CAN_L,各个节点通过这两条线实现信号的串行差分传输,为了避免信号的反射...

YEYUANGEN的专栏 5240

【例1896】report all clearance datasets 报告所有间隙数据集

report all clearance datasets 报告所有间隙数据集》这是一个NX二次开发官方小例子,下面是代码和解析。相较于混乱、未经验证的代码,官方案例能够确保开发者获得准确的开发方法,这些官方示例代码经过严格测试,能够正确地反映出NX软件的功能和API使用方式,有助于开发者系统地掌握NX二次开发技能,提高开发质量和效率。本专栏订阅后是永久阅读的。欢迎一起学习NX二次开发案例,逐步积累宝贵的经验,早日成为行业专家。

王牌飞行员_里海的博客 643

合肥工业大学操作系统实验8

依据操作系统课程所介绍的地址映射与内存共享的原理,本实验的目的是深入理解物理内存的分页管理方式。 深入理解操作系统的段、页式内存管理。包括理解段表、二级页表,以及逻辑地址、线性地址、 物理地址的映射过程。编程实现段、页式内存管理上的内存共享,从而深入理解操作系统的内存管理。从而加深对教材上地址映射与内存共享的理解。

Martin-share的博客 1720

Struts常见错误及原因

Struts常见错误及原因Common Struts Errors and CausesThis page contains errors and exceptions commonly encountered during web application development using Struts. Along with the exception or error messages th

Closed 1125

C#企业级工作流管理:从优化到重构的实战指南——代码深度解析与性能调优策略

本文通过Workflow Core与Elsa引擎实现企业审批流程优化,将处理时间从72小时缩短至2小时,效率提升200%。文章包含12个代码示例,涵盖流程梳理、引擎选型(对比Workflow Core与Elsa特性)、模块化重构(策略模式应用)及异常处理机制。关键实现包括:可视化流程建模、Serilog性能监控、Elsa集成配置、策略模式消除重复代码,以及补偿事务设计。最终方案支持高并发,通过数据库连接池优化性能,为企业级工作流系统提供完整技术方案。

墨夶的博客 896

[转载]Struts 中常见错误

Struts 中常见错误 以下所说的struts-config.xml和ApplicationResources.properties等文件名是缺省时使用的,如果你使用了多模块,或指定了不同的资源文件名称,这些名字要做相应的修...

congji3817的博客 173

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Struts 中常见错误

以下所说的struts-config.xml和ApplicationResources.properties等文件名是缺省时使用的,如果你使用了多模块,或指定了不同的资源文件名称,这些名字要做相应的修改。1、“No bean found under attribute key XXX”在struts-config.xml里定义了一个ActionForm,但type属性指定的类不存在,type属性的

ppzhguy的专栏 1118

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

struts常见的错误

This page contains errors and exceptions commonly encountered during web application development using Struts. Along with the exception or error messages themselves, potential causes of these errors a

seinbar的专栏 1102

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Struts常见错误及原因分析

本篇文章包含了在用Struts开发web应用时经常碰到的一些异常和错误,根据异常或错误信息本身,经常可以找到潜在的错误发生原因。下面列出了一些Struts的常见错误和异常,并给出了一些可能发生此类错误或异常的原因。有的后面有相关连接,你可以通过它找到更多的信息。 Cannot retrieve map

宁静以致远,淡泊以明志 3447

Struts常见错误的全面汇总

核心提示:J2EE综合Struts常见错误的全面汇总 1、No bean found under attribute key XXX 在struts-config.xml里定义了一个ActionForm,但type属性指定的类不存在,type属性的值应该是Form类的全名。或者是,在Action的定义中,name或attribute属性指定的ActionForm不 J2EE综合—St...

java 166

struts2常见错误总结

1. Console错误: Exception starting filter struts2    No mapping found for dependency [type=com.opensymphony.xwork2.ObjectFactory, name='default'] in public void com.opensymphony.xwork2.config.provide

I_am_JiaXiaoLong的专栏 871

Struts常见错误汇总

JAVA高级编程之:Struts常见错误汇总            作者:  来源:赛迪网  (2006-09-01)        以下所说的struts-config.xml和ApplicationResources.properties等文件名是缺省时使用的,如果你使用了多模块,或指定了不同的资源文件名称,这些名字要做相应的修改。   1、“No bean found under a

疯猫 842

【Struts】Struts常见错误

以下所说的struts-config.xml和ApplicationResources.properties等文件名是缺省时使用的,如果你使用了多模块,或指定了不同的资源文件名称,这些名字要做相应的修改。  1、“No bean found under attribute key XXX”在struts-config.xml里定义了一个ActionForm,但type属性指定的类不存在,ty

465

struts常见错误和解决方法

[struts学习笔记]stsuts常见错误和解决方法刚刚接触struts,感觉好多的东西都不太明白,感觉最重要的就是看不懂错误以及解决方法。这两天在网上找了些资料,copy了过来,为方便以后的继续学习打个基础。   PS:以下所说的struts-config.xml和ApplicationResources.properties等文件名是缺

Ba_Jin_Zhi的专栏 844
上一篇: 出现java.lang.NullPointerException此类错误
下一篇: JBUILDER下安装sql server驱动
dotnetguy
博客等级 码龄21年 0粉丝 16原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值