Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Struts2 ognl.MethodFailedException:对象[java.lang.NoSuchMethodException:([Ljava.lang.String;)]的方法失败_Struts2_Ognl - Fatal编程技术网

Struts2 ognl.MethodFailedException:对象[java.lang.NoSuchMethodException:([Ljava.lang.String;)]的方法失败

Struts2 ognl.MethodFailedException:对象[java.lang.NoSuchMethodException:([Ljava.lang.String;)]的方法失败,struts2,ognl,Struts2,Ognl,我有一个userCreateDate字段,当我第一次添加数据时,它会被插入到相应的表中,但是当我尝试通过单击Javascript并将值设置为相应的textfields来更新相同的记录时,它为字段userTypeEntity.userCreateDate提供了无效的字段值。并且日期字段值在validate中为null方法 你能帮我摆脱这个错误吗。 我的JSP是: <table width="100%" style="border-collapse: collapse;" border="0"

我有一个userCreateDate字段,当我第一次添加数据时,它会被插入到相应的表中,但是当我尝试通过单击Javascript并将值设置为相应的textfields来更新相同的记录时,它为字段userTypeEntity.userCreateDate提供了无效的字段值。并且日期字段值在validate中为null方法 你能帮我摆脱这个错误吗。 我的JSP是:

<table width="100%" style="border-collapse: collapse;" border="0" bordercolor="#006699" align="center">
                <tr>
                    <s:hidden id="id" name="userGroupEntity.userGroupId"/>
                    <s:textfield id="name" name="userGroupEntity.userGroupName"  key="label.groupName" maxlength="15" size="30" required="true" labelSeparator=""/>
                    <s:textfield id="desc" name="userGroupEntity.userGroupDesc"  key="label.groupDesc" maxlength="20" size="30" required="true" labelSeparator=""/>
                    <s:textfield id="cdate" name="userGroupEntity.userCreatedDate" key="label.CreatedDt" size="30" readonly="true" cssStyle="background-color:#E7EBDD;" labelSeparator=""/>
                    <s:textfield id="mdate" name="userGroupEntity.userModifiedDate" key="label.ModifiedDt" size="30" readonly="true" cssStyle="background-color:#E7EBDD;" labelSeparator=""/>
                    <s:radio     id="status" name="userGroupEntity.userActive"  key="label.status" list="userGroupStatus" required="true" labelSeparator=""/>
                </tr>
                <tr>
                    <td colspan="100%" align="center"><hr></td>
                </tr>
                <tr>
                    <td colspan="100%" align="center">
                        <s:submit id="save"  theme="simple" name="save" key="label.save"/>
                        <s:reset  id="reset" theme="simple" name="reset" key="label.reset"/>
                        <s:a href="userGroupView">
                            <img border="0" src='<s:url value="/images/b_cancel.gif"></s:url>' width="50" height="20" alt="Go to User Group Master">
                        </s:a>                      
                    </td>
                </tr>
                <tr>
                    <td colspan="100%">
                        <s:if test="hasActionMessages()"><div style="color:red;"><s:actionmessage/></div></s:if>
                    </td>
                </tr>
            </table>
<s:if test="{groupList.size() != 0}">
                <s:iterator value="groupList" var="group">
                    <tr>
                        <td><s:property value="userGroupName"/></td>
                        <td><s:property value="userGroupDesc"/></td>
                        <td><s:property value="userCreatedDate"/></td>
                        <td><s:property value="userModifiedDate"/></td>
                        <td align="center"><b><a href="#" onclick="javascript:userGroupEdit('edit','${userGroupId}','${userGroupName}','${userGroupDesc}','${userCreatedDate}','${userModifiedDate}');">Edit</a></b>
                            &nbsp;&nbsp;|&nbsp;&nbsp;<b><a href="#" onclick="javascript:userGroupDelete('userGroupDelete.action?groupId=${userGroupId}');">Delete</a></b>
                        </td>
                    </tr>
                </s:iterator>
            </s:if>

我得到了解决方案:在Javascript中,我将日期格式化为

function setDateFormat(strDate){
    //strDate '2014-06-18'      
     //alert(strDate.length);
    if(strDate!=''){
        var y,m,d;
        y = strDate.substring(0,4);//alert(y);
        m = strDate.substring(5,7);//alert(m);
        d = strDate.substring(8,10);//alert(d);
        var newDate = m+"/"+d+"/"+y;
        //alert(newDate);
        return newDate;
    }else{
        if(typeof(strDate) == 'string'){
            newDate = '';
            return newDate;
        }
    }
}

这些日期字段现在被持久保存在数据库中,并且没有类似validate方法字段的无效字段值这样的Struts2字段消息。

看起来您有验证错误,您可以发布validation.xml.Thanx Roman作为您的响应。但我不想验证此字段。此日期文本字段由单击edit填充我没有使用validation.xml,我使用的是注释。帮助我…发布JSP和操作代码。我附加了JSP和操作类发布javascript。
function userGroupEdit(flag,id,name,desc,cdate,mdate){
    alert(flag+id+name+desc+cdate+mdate);
    if(flag=='edit'){
        document.getElementById("id").style.display="block";
        document.getElementById("id").value=parseInt(id);
        document.getElementById("name").value=name;
        document.getElementById("desc").value=desc;
        document.getElementById("cdate").value=cdate;
        document.getElementById("mdate").value=mdate;
        document.getElementById("statusY").checked=true;

    }else{
        //document.getElementById("save").style.display="block";
    }
    //window.location = url;//"${pageContext.request.contextPath}/"+url;
    return true;
}
function setDateFormat(strDate){
    //strDate '2014-06-18'      
     //alert(strDate.length);
    if(strDate!=''){
        var y,m,d;
        y = strDate.substring(0,4);//alert(y);
        m = strDate.substring(5,7);//alert(m);
        d = strDate.substring(8,10);//alert(d);
        var newDate = m+"/"+d+"/"+y;
        //alert(newDate);
        return newDate;
    }else{
        if(typeof(strDate) == 'string'){
            newDate = '';
            return newDate;
        }
    }
}