こんにちは、私はstruts2ハイバーネーションアプリケーションでjqgridを使用しています。私はビューページですべての応答を正しく取得しました。私はFirebusツールでこれを見ることができます。しかし、私の問題はどのように私はグリッドの値を印刷することができます。私はこのページの下に私のJSPページの応答をします。ここでstruts2のjqGridでレスポンスを表示するには
は私のスクリプトは私のREPONSEのcomeeはこの
{"allUsers":"success",
"allUsersViaScript":"success",
"cell":[
{"id":1,"name":"Aaronsburg","stateCode":"39"},
{"id":2,"name":"Abbeville","stateCode":"2"},
{"id":3,"name":"Abbeville","stateCode":"11"},
{"id":4,"name":"Abbeville","stateCode":"19"},
{"id":5,"name":"Abbeville","stateCode":"26"},
{"id":6,"name":"Abbeville","stateCode":"41"},
{"id":7,"name":"Abbot","stateCode":"22"},
{"id":8,"name":"Abbotsford","stateCode":"49"},
{"id":9,"name":"Abbott","stateCode":"44"},
{"id":10,"name":"Abbottstown","stateCode":"39"},
{"id":11,"name":"Abbyville","stateCode":"17"},
{"id":12,"name":"Abell","stateCode":"21"},
{"id":13,"name":"Abercrombie","stateCode":"29"},
{"id":14,"name":"Aberdeen","stateCode":"14"},
{"id":15,"name":"Aberdeen","stateCode":"18"},
{"id":16,"name":"Aberdeen","stateCode":"21"},
{"id":17,"name":"Aberdeen","stateCode":"26"},
{"id":18,"name":"Aberdeen","stateCode":"28"},
{"id":19,"name":"Aberdeen","stateCode":"36"},
{"id":20,"name":"Aberdeen","stateCode":"42"},
{"id":21,"name":"Aberdeen","stateCode":"48"},
{"id":22,"name":"Aberdeen Proving Ground","stateCode":"21"},
{"id":23,"name":"Abernant","stateCode":"2"},
{"id":24,"name":"Abernathy","stateCode":"44"},
{"id":25,"name":"Abie","stateCode":"30"},
{"id":26,"name":"Abilene","stateCode":"17"},
{"id":27,"name":"Abilene","stateCode":"44"},
{"id":28,"name":"Abingdon","stateCode":"15"},
{"id":29,"name":"Abingdon","stateCode":"21"},
{"id":30,"name":"Abingdon","stateCode":"46"},
{"id":31,"name":"Abington","stateCode":"7"},
{"id":32,"name":"Abington","stateCode":"20"},
{"id":33,"name":"Abington","stateCode":"39"},
{"id":34,"name":"Abiquiu","stateCode":"33"},
{"id":35,"name":"Abita Springs","stateCode":"19"},
{"id":36,"name":"Abrams","stateCode":"49"},
{"id":37,"name":"Absaraka","stateCode":"29"},
{"id":38,"name":"Absarokee","stateCode":"27"},
{"id":39,"name":"Absecon","stateCode":"32"},
{"id":40,"name":"Acampo","stateCode":"5"},
{"id":41,"name":"Accident","stateCode":"21"},
{"id":42,"name":"Accokeek","stateCode":"21"},
{"id":43,"name":"Accomac","stateCode":"46"},
{"id":44,"name":"Accord","stateCode":"20"},
{"id":45,"name":"Accord","stateCode":"35"},
{"id":46,"name":"Accoville","stateCode":"50"},
{"id":47,"name":"Ace","stateCode":"44"},
{"id":48,"name":"Achille","stateCode":"37"},
{"id":49,"name":"Achilles","stateCode":"46"},
{"id":50,"name":"Ackerly","stateCode":"44"}
],
"cityList":null,
"page":1,
"records":29738,
"rowNum":null,
"rows":50,
"total":595,
"userList":[],
"userList1":null
}
よう
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list2").jqGrid({
url:'server.action?q=2',
datatype: "json",
colNames:['id','name'],
colModel:[ {name:'id',index:'id'},
{name:'name',index:'name'}],
rowNum:10,
pager: '#pager2',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"JSON Example" });
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
});
</script>
私のJSPページ内にあり、また私のstruts.xmlは、このようにしています。
<action name="server" class="com.actions.userList" method="getAllUsersViaScript" >
<result name="success" type="json" >/WEB-INF/list.jsp</result>
</action>
コードです。
また、自分のjavaページで初期化したすべての変数にsetterとgetterを書きました。誰も私の側で何が間違いであるかについての任意のアイデアを持っています。
EDIT#1
私はコードを貼り付けた場合、それは私のjspページにjqgridテンプレートを生成するが、データは私が私のコンソールで正しく、すべてのデータを得たjqgrid evethouhに移入されていません。ページ区切りとグリッド内のすべての作業がリストされる必要があるデータをグリッドに挿入することはできません。あなたのhtml身体の部分で
"印刷"?それらをグリッドに表示することを意味しますか? –
はい、実際には私は正しくコンソールにデータを持っています。質問のデータを印刷しました。私はグリッド内でそのデータを表示したい。 – user359187
jqGridプラグインを使用していないのはなぜですか?それは問題なしでグリッドを表示するのに役立ちます – batbaatar