关于ognl.OgnlException: target is null for setProperty
2015-04-29 12:32
375 查看
这个错误网上很多解决方法,有说action中的类要new的,类要有默认构造函数等等很多方法,我遇到的却很奇葩,变量名必须为小写,PMenu,变量名为pMeun就不行,为pmenu就可以。
下面附上我的代码。
jsp页面
action中的代码
下面附上我的代码。
jsp页面
<form id="menu_add_form" action="${pageContext.request.contextPath}/menuAction!addMenu.action" method="post"> <table> <tr> <td><fmt:message key="menu.name" /></td> <td> <input type="text" name="pmenu.name" class="easyui-validatebox" data-options="required:true"/> </td> <td><fmt:message key="menu.code" /></td> <td> <input type="text" name="pmenu.code"/> </td> </tr> <tr> <td><fmt:message key="menu.turn" /></td> <td> <input type="text" name="pmenu.turn"/> </td> <td><fmt:message key="menu.parent" /></td> <td> <input id="menu_add_parent" type="text" name="pmenu.parent_id" class="easyui-validatebox" data-options="required:true"/> </td> </tr> <tr> <td> <a href="javascript:void(0)" onclick="javascript:add()" class="easyui-linkbutton">easyui</a> </td> <td> </td> </tr> </table> </form> <script type="text/javascript"> function add(){ $('#menu_add_form').submit(); } </script>
action中的代码
private PMenu pmenu;//此处变量名必须为小写 public void addMenu(){ System.out.println(pmenu.getName()+ " --- " + pmenu.getCode() + "---"+ pmenu.getParent_id()); } public void getMenuTree(){ super.writeJson(menuService.getMenuTree()); } public PMenu getPmenu() { return pmenu; } public void setPmenu(PMenu pmenu) { this.pmenu = pmenu; }
相关文章推荐
- 14-关于ognl.OgnlException: target is null for setProperty(null的解决方案)
- 关于ssh添加和删除报错ognl.OgnlException: target is null for setProperty(null, "cid", [Ljava.lang.String;@3402
- struts2 关于ognl.OgnlException: target is null for setProperty(null的解决方案 .
- 关于ognl.OgnlException: target is null for setProperty(null的解决方案
- 关于struts2异常ognl.OgnlException: target is null for setProperty
- struts2 <s:submit>国际化时提示警告关于ognl.OgnlException: target is null for setProperty(null的解决方案
- 关于ognl.OgnlException: target is null for setProperty(null的解决方案
- ognl.OgnlException: target is null for setProperty(null, "y", [Ljava.lang.St
- ognl.OgnlException: target is null for setProperty
- 【解决方法】ognl.OgnlException: target is null for setProperty
- ognl.OgnlException: target is null for setProperty
- ognl.OgnlException: target is null for setProperty(null, "tkscName", [Ljava.lang.String;@1bf9980)
- ognl.OgnlException: target is null for setProperty(null, "x",)错误
- ognl.OgnlException: target is null for setProperty异常解决
- ognl.OgnlException: target is null for setProperty(null, "offset", [Ljava.lang.String;@1e86eb7)
- ognl.OgnlException: target is null for setProperty(null, "newsid", [Ljava.lan
- ognl.OgnlException: target is null for setProperty(null, "login", [Ljava.lang.String;@133cdbd) 国际化时,登录按钮报错
- ognl.OgnlException: target is null for setProperty...
- Warning Error user.userId value userid 出现错误ognl.OgnlException: target is null for setProperty(null, "userid", [Ljava.lang.String;@19af9e98)
- ognl.OgnlException: target is null for setProperty(null, "x",)错误