开发者社区 问答 正文

struts 2 实体疑问?报错

    我用struts 2 的实体和页面

    action : 

     private TGxGoout tGxGoout = new TGxGoout();

    public TGxGoout gettGxGoout() {
        return tGxGoout;
    }
    public void settGxGoout(TGxGoout tGxGoout) {
        this.tGxGoout = tGxGoout;
    }
页面:<input id="tGxGoout_beginTime" readonly name="tGxGoout.beginTime" type="text" style="width:80%;" class="searchtxt"  value="${tGxGoout.beginTime}"/>

不管是我新增还是编辑都会报错:ognl.OgnlException: target is null for setProperty(null, "id", [Ljava.lang.String;@2d56d401)

如果我改了action的tGxGoout 变量名,然后程序就可以正常运行。

求大神指教这是什么情况啊?


展开
收起
爱吃鱼的程序员 2020-06-20 16:40:53 418 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    可能是OGNL规范认为javabean的setter/getter方法的set/get后第一个字母要大写

    命名规范什么事都没有

    变量的命名问题,建议不要用tGxGoout这样的命名,命名时,第一个和第二个字母都要小写,然后用IDE自动生成get/set方法我想知道这到底是什么原因造成的??ONGL的规范吗?

    2020-06-20 16:41:10
    赞同 展开评论
问答分类:
问答地址: