java ee - Keep getting the OgnlException: source is null for getProperty(null, "0") Warning -
ok. using below .jsp , java code access notmessagefieldlist
. works fine; however, keep getting ognlexception: source null getproperty(null, "0"
) warning when leave page. seems struts 2 trying null values , triggers warning. there way rid of without adjusting tomcat settings?
jsp:
<s:iterator var="counter" begin="0" end="3"> <tr> <th style="font-size: 120%; font-weight: 900; color: red;">x</th> <td style="font-size: 80%;">new</td> </tr> <tr> <td><b>field name:</b> </td> <td style="float: left"> <s:textfield name="notmessagefieldlist[%{counter}].tag" size="47"> </s:textfield> </td> </tr> <tr> <td><b>description:</b> </td> <td style="float: left"> <s:textfield name="notmessagefieldlist[%{counter}].description" size="47"> </s:textfield> </td> </tr> <tr> <td><b>data type:</b> </td> <td style="float: left"> <s:select list="validdatatypes" name="notmessagefieldlist[%{counter}].datatype" key="datatype.required"/> </td> </tr> </s:iterator>
java action:
private list<notificationmessagefield> notmessagefieldlist = new arraylist<>(4); public list<notificationmessagefield> getnotmessagefieldlist() { return notmessagefieldlist; } public void setnotmessagefieldlist(@nullable final list<notificationmessagefield> notmessagefieldlist) { if (collectionutils.isnotemptylist(notmessagefieldlist)) { this.notmessagefieldlist.clear(); this.notmessagefieldlist = new arraylist<>(notmessagefieldlist); } else { this.notmessagefieldlist = new arraylist<>(5); } }
java pojo (assume regular set up, getters/setters):
public notificationmessagefield(final string tag, final string description, final string datatype) { this.tag = tag; this.description = description; this.datatype = datatype; }
add value attribute textfields. preset textfields initial value , once value preset won't evaluated name.
<s:textfield name="notmessagefieldlist[%{counter}].tag" size="47" value="">
Comments
Post a Comment