`

关于target is null for setProperty的问题总结

    博客分类:
  • java
 
阅读更多

关于这种问题的几种可能性总结下:

1.       对应的属性没有加get set  方法

2.       提交表单中有更多的name属性而对应的action 或者model里面没有这个方法(这里重要就包括一个图片button  往往让人们难以发现)如下面表示:

<input type="image" name="Submit" value="提交" onclick="return checkpwd();" src="images/a_tj.gif"/>

错误信息: target is null for setProperty(null, "x", [Ljava.lang.String;@b0c40e)

3.       在没有spring帮助注入的前况下我们action里面的model 一定要手动new 出来并且在model里面添加空的构造方法

4.       Action里面的model 实例对象名字和我们表单中的名字不一致的时候

 

5、struts2中表单提交按钮:

<input type="Submit" name="Submit" value=" 查 询 " />

这样会报题目的错误.其实把submit的name属性删掉或者

<input type="button" name="Submit" value=" 查 询 " onclick="document.form.submit();"/>

都是可以解决的,估计凡是在struts2中没有定义getter,setter方法的form中的input都要被抛出异常

 

6、原来的model类中重写了构造方法,却没有提供默认的空构造函数。

加上public Book(){};即可。

 

7、最后还有一个坑爹的问题:你的属性命名规范。

例如:有一个表t_txn_info表对应的pojo类是TTxnInfo

你在action类中有一个属性private TTxnInfo tTxnInfo;

这样导致自动生成的setter/getter方法不能识别tTxnInfo,会识别成txnInfo.

曾经吃过亏。最好把tUser的第一第二个字母都小写——tuser,或者去掉t。

最后一直排查问题就是这个变量名的问题..

 

 

 

分享到:
评论

相关推荐

    Qemu-1.0.1 for windows

    set a global default for a driver property -mtdblock file use 'file' as on-board Flash memory image -sd file use 'file' as SecureDigital card image -pflash file use 'file' as a parallel flash image -...

    weapp.qrcode.js

    var setProperty = function setProperty(target, options) { if (defineProperty && options.name === '__proto__') { defineProperty(target, options.name, { enumerable: true, configurable: true, ...

    FastReport.v4.15 for.Delphi.BCB.Full.Source企业版含ClientServer中文修正版支持D4-XE5

    + [enterprise] added property "Reports" - "MaxReports" in server configuration - set the limit of maximum report threads, set 0 for unlimit + [enterprise] added property "Logs" - "SchedulerLog" in ...

    微软内部资料-SQL性能优化3

    For example, if T1 writes some object that is in T2’s input or output set, there is a dependency between T1 and T2. Bad Dependencies These include lost updates, dirty reads, non-repeatable reads, ...

    ap6212a0_a33_sc3817r_神舟验证版本_借用nvram_ap6210这个配置文件_20170626_1834没有外层目录.7z

    [ 3.968638] [mmc]: sdc2 set ios: clk 25000000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 3.968734] [mmc]: mclk 0xf1c20090 0xc100000b [ 3.989421] Bluetooth: BNEP filters: protocol ...

    带注释的Bootstrap.java

    System.setProperty( Globals.CATALINA_HOME_PROP, catalinaHomeFile.getPath()); // Then base String base = System.getProperty(Globals.CATALINA_BASE_PROP); //设置catalinaBaseFile if (base == null)...

    acpi控制笔记本风扇转速

    Disassembler - fix for error emitted for unknown type for target of scope operator. Now, ignore it and continue. Disassembly of an FADT now verifies the input FADT and reports any errors found. Fix ...

    Delphi7.1 Update

    * When updating blob fields in a TClientDataset with the LogChanges property set to False, blob data is lost from other unrelated records (Quality Central 6591). * Using a Filter or Locate with a ...

    qemu-0.13.0(编译过全处理器支持)

    set a global default for a driver property -mtdblock file use 'file' as on-board Flash memory image -sd file use 'file' as SecureDigital card image -pflash file use 'file' as a parallel flash image -...

    网页制作完全手册

    In this example, there are two widths: an extended property set within the object element, and a property belonging to the control that is set using the param element. To access these from script, you...

    FastReport 4.9

    + [enterprise] added property "Html" - "URLTarget" in server configuration - allow select the target attribute for report URLs + [enterprise] added property "ReportsFile" - path to file with reports ...

    Fast Report Enterprise v4.9.32 Full Source

    + [enterprise] added property "Html" - "URLTarget" in server configuration - allow select the target attribute for report URLs + [enterprise] added property "ReportsFile" - path to file with reports ...

    C# ListView 支持分组时拖拉排序的控件

    // the InsertionMark.AppearsAfterItem property accordingly. Rectangle itemBounds = this.GetItemRect(targetIndex); if (targetPoint.X &gt; itemBounds.Left + (itemBounds.Width / 2)) { this....

    ap6212a0_a33_sc3817r_服务器验证通过_bt已经通了_wifi需要修改配置_需要再次验证_20170626_1549.7z

    [ 3.968638] [mmc]: sdc2 set ios: clk 25000000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 3.968734] [mmc]: mclk 0xf1c20090 0xc100000b [ 3.989421] Bluetooth: BNEP filters: protocol ...

    stdafx.h代码

    // a target for user commands class CWnd; // a window / HWND wrapper class CDialog; // a dialog // standard windows controls class CStatic; // Static control class CButton; // Button control ...

    springmybatis

    后来项目结束了,我也没写总结文档。已经过去好久了。但最近突然又对这个ORM 工具感兴趣。因为接下来自己的项目中很有可能采用这个ORM工具。所以在此重新温习了一下 mybatis, 因此就有了这个系列的 mybatis 教程. ...

    !!!!ap6212a0_a33_sc3817r_验证通过_修正wifi的配置文件为nvram_ap6212.txt

    [ 3.968638] [mmc]: sdc2 set ios: clk 25000000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B [ 3.968734] [mmc]: mclk 0xf1c20090 0xc100000b [ 3.989421] Bluetooth: BNEP filters: protocol ...

    flash action script 经典字典教程大全,学flash必备

    _target Button._target、MovieClip._target、TextField._target _totalframes MovieClip._totalframes _url Button._url、MovieClip._url、TextField._url _visible Button._visible、MovieClip._visible、...

    应用Dephi 开发佳能照相机API

    * Description: This is the Sample code to show the usage of EDSDK. * * * * * ******************************************************************************* * * * Written and developed by Camera ...

    JdbcTemplateTool.zip

    /*Data for the table `employee` */ insert into `employee`(`id`,`name`,`join_date`,`age`) values (1,'jack','2014-09-22 00:00:00',23),(2,'ted','2014-08-30 00:00:00',25),(3,'jim','2014-06-22...

Global site tag (gtag.js) - Google Analytics