1

StudentDetailsVo リスト項目にオブジェクトを割り当てたいです。

このエラーが発生し続けます。

 $("#searchAtten").click(function(){
            $("#tablerows").empty();
            var sectionId=$("#selSection :selected").attr("id");
            var studid=$("#studentid").val();
            var datee = ${resultVO.monthEndDate}
            var reqD = ${resultVO.reqdEndDate}
            //I need to assign object here 
            var namem =${resultVO.studentList}
            alert("namem"+namem);
            var betweentDate=  reqD-datee;
            alert("betweentDate = "+betweentDate);
            for(var i=1;i<=datee;i++){
                alert(i);
                $("#tableRows tr").append('<th width="129" scope="col"  style="text-align: center;">'+i+'</th>'); 
            } 
             if(sectionId == undefined)
                {
                sectionId = "null";
                }
             if(studid == "")
            {
                studid = "null";
            } 
                fetch_atten(sectionId,studid);          
                });
    });

私はVOファイルからこの値を取得しています:

<% if (session.getAttribute("resultVO") != null){
     AttendanceResultVO resultVO= (AttendanceResultVO)session.getAttribute("resultVO");
         } 
%>

**> 私の発火バグのエラーは次のとおりです。

SyntaxError: missing ] after element list
[Break On This Error]     

var namem =[com.sfmfm.vo.StudentDetailsVO@487c5f]

myschool.jsp (line 53, col 43)**
4

2 に答える 2

1

列43を見ると、「@」になっています。使用する

var namem = ['com.sfmfm.vo.StudentDetailsVO@487c5f'];

テキストは使用できないtoStringであり、オブジェクト自体にマッピングできなくなりましたが、私は恐れています。

縮小、不要な空白/改行の削除のために、セミコロンのままにします。

于 2013-02-14T13:25:04.080 に答える
0

このようにすることをお勧めします

        var datee = <%=resultVO.monthEndDate}%>;
        var reqD = <%=resultVO.reqdEndDate%>
        var namem =<%=resultVO.studentList%>

このような代わりに

       var datee = ${resultVO.monthEndDate}
        var reqD = ${resultVO.reqdEndDate}
        //I need to assign object here 
        var namem =${resultVO.studentList}
于 2013-02-14T13:37:23.327 に答える