HTTP Status 406 with spring mvc jqgrid -
i trying load model data jqgrid in spring mvc application. working fine in spring mvc application following code , dependencies,but not working me,i getting following error. 406 error(http status error):the resource identified request capable of generating responses characteristics not acceptable according request "accept" headers. please needful.
**more data:** spring version :<spring.version>4.1.0.release</spring.version> spring security version: <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-core</artifactid> <version>3.2.4.release</version> </dependency> java version:<java.version>1.8</java.version> **controller:** @requestmapping(value = "/getpackagelist", method = requestmethod.get) public @responsebody customresponse getpackagelist( ) { list<customize> customize = customize.findallcustomize(); system.out.println("comes here fetch list"); customresponse response = new customresponse(); response.setcustomize(customize); response.setrecords(string.valueof(customize.size())); response.setpage("1"); response.settotal("10"); //system.out.println("response::::"+response); return response; } **pom.xml** <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-mapper-asl</artifactid> <version>1.9.13</version> <scope>compile</scope> </dependency> <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-core-asl</artifactid> <version>1.9.13</version> <scope>compile</scope> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-databind</artifactid> <version>2.2.3</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-annotations</artifactid> <version>2.2.3</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-core</artifactid> <version>2.2.3</version> </dependency> **jqgrid:** <script> $(function() { $("#grid").jqgrid({ url:'${pagecontext.request.contextpath}/superadmin/getpackagelist', datatype: 'json', mtype: 'get', colnames:['basepackage','details','cost','duration'], colmodel:[ {name:'basepackage',index:'basepackage', width:49,sortable:true,sorttype:'int'}, {name:'details',index:'details', width:49,sortable:false}, {name:'cost',index:'cost', width:49,sortable:false} , {name:'duration',index:'duration', width:49,sortable:false} ], getdata: { }, rownum:10, rowlist:[5,10,15,20], height: 200, autowidth: true, rownumbers: false, pager: '#pager', sortname: 'basepackage', caption:"package list", viewrecords: true, ignorecase: true, sortorder: "asc", emptyrecords: "empty records", loadonce: true, loadcomplete: function() { }, jsonreader : { total: "total", page: "page", records: "records", root: "customize", repeatitems: false, cell: "cell", id: "basepackage" } }); $("#grid").jqgrid('navgrid','#pager', {edit:false,add:false,del:false,search:true}, { }, { }, { }, { sopt:['cn', 'ne', 'lt', 'gt', 'eq', 'bw', 'ew'], closeonescape: true, multiplesearch: false, closeaftersearch: true } ); $("#btnfilter").click(function(){ $("#grid").jqgrid('searchgrid', {multiplesearch: false, sopt:['cn', 'ne', 'lt', 'gt', 'eq', 'bw', 'ew']} ); }); }); </script> reviewed patches <div id="jqgrid"> <table id="grid"></table> <div id="pager"></div> </div>
since controller returning json request server has contain header accept:application-json
. make sure set caller.
Comments
Post a Comment