日期:2014-05-20  浏览次数:20808 次

求教jqgrid用jsp的实现
我在网上查了很多资料,示例很少,官方示例是用php写的,不懂
我想用jsp写,后来找到一个代码:http://huashui.org/post/jqgrid-base-study-7.html
但他用的是struts2,我只想用1,不知如何写
我写的jsp代码如下,查询和刷新按钮无法显示,无法实现分页功能,请各位高手指教后台程序怎么写
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <!-- 先引入样式表 -->
  <link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.7.1.custom.css" />
  <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" />
  <link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" />
  <!-- 引入jQuery 核心文件,UI theme核心包以及jqGrid核心包、语言包 -->
  <script src="js/jquery.js" type="text/javascript"></script>
  <script src="js/jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script>
  <script src="js/jquery.layout.js" type="text/javascript"></script>
  <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
  <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
  <script src="js/jquery.tablednd.js" type="text/javascript"></script>
  <script src="js/jquery.contextmenu.js" type="text/javascript"></script>
  <script src="js/ui.multiselect.js" type="text/javascript"></script>
  <!-- css代码 -->
  <style>
  html,body {
margin: 10; /* Remove body margin/padding */
padding: 0;
overflow: hidden; /* Remove scroll bars on browser window */
font-size: 75%;
}
 
.ui-tabs-nav li {
position: relative;
}
 
.ui-tabs-selected a span {
padding-right: 10px;
}
 
.ui-tabs-close {
display: none;
position: absolute;
top: 3px;
right: 0px;
z-index: 800;
width: 16px;
height: 14px;
font-size: 10px;
font-style: normal;
cursor: pointer;
}
 
.ui-tabs-selected .ui-tabs-close {
display: block;
}
 
.ui-layout-west .ui-jqgrid tr.jqgrow td {
border-bottom: 0px none;
}
 
.ui-datepicker {
z-index: 1200;}
  </style>
  <script type="text/javascript">  
jQuery(document).ready(function(){  
  jQuery("#list1").jqGrid({ //jqGrid固定的写法:jQuery("#list").jqGrid({参数})
  datatype: "local", //数据来源,本地数据  
  height: 250,//表格高度  
  width:1000, //表格宽度
  colNames:['编号','Date', 'Client', 'Amount','Tax','Total','Notes'],  
  colModel:[  
  {name:'id',index:'id', width:60, sorttype:"int"},  
  {name:'invdate',index:'invdate', width:90, sorttype:"date"},  
  {name:'name',index:'name', width:100},  
  {name:'amount',index:'amount', width:80, align:"right",sorttype:"float"},  
  {name:'tax',index:'tax', width:80, align:"right",sorttype:"float"},  
  {name:'total',index:'total', width:80,align:"right",sorttype:"float"},  
  {name:'note',index:'note', width:150, sortable:false}