3

嗨,我想在 jsp 中创建一个 jtable,经过大量谷歌搜索后,我找到了这个网站,因为这个网站说我会有一个默认表,但是当我运行它时,我得到一个空白页。请帮助我 http://jtable。 org/GettingStarted#ListAction

   <html>
<head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<!-- Include one of jTable styles. -->
<link href="/jtable/themes/metro/blue/jtable.min.css" rel="stylesheet" type="text/css" />

<!-- Include jTable script file. -->
<script src="/jtable/jquery.jtable.min.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $('#PersonTableContainer').jtable({
            title: 'Table of people',
            actions: {
                listAction: '/GettingStarted/PersonList',
                createAction: '/GettingStarted/CreatePerson',
                updateAction: '/GettingStarted/UpdatePerson',
                deleteAction: '/GettingStarted/DeletePerson'
            },
            fields: {
                PersonId: {
                    key: true,
                    list: false
                },
                Name: {
                    title: 'Author Name',
                    width: '40%'
                },
                Age: {
                    title: 'Age',
                    width: '20%'
                },
                RecordDate: {
                    title: 'Record date',
                    width: '30%',
                    type: 'date',
                    create: false,
                    edit: false
                }
            }
        });
    });
</script>
</head>
<body>
<div id="PersonTableContainer"></div>
</body>
</html>
4

2 回答 2

1

在此处输入图像描述

<html>
<head>

<script src="https://raw.github.com/akashshinde/project/master/scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="https://github.com/akashshinde/project/raw/master/scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>

<!-- Include one of jTable styles. -->

<link href="https://raw.github.com/akashshinde/project/master/themes/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
<link href="https://raw.github.com/akashshinde/project/master/scripts/jtable/themes/lightcolor/blue/jtable.css" rel="stylesheet" type="text/css" />

<!-- Include jTable script file. -->
<script src="https://raw.github.com/akashshinde/project/master/scripts/jtable/jquery.jtable.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
    $('#PersonTableContainer').jtable({
        title: 'Table of people',
        actions: {
            listAction: '/GettingStarted/PersonList',
            createAction: '/GettingStarted/CreatePerson',
            updateAction: '/GettingStarted/UpdatePerson',
            deleteAction: '/GettingStarted/DeletePerson'
        },
        fields: {
            PersonId: {
                key: true,
                list: false
            },
            Name: {
                title: 'Author Name',
                width: '40%'
            },
            Age: {
                title: 'Age',
                width: '20%'
            },
            RecordDate: {
                title: 'Record date',
                width: '30%',
                type: 'date',
                create: false,
                edit: false
            }
        }
    });
});
</script>
</head>
<body>
<div id="PersonTableContainer"></div>
</body>
</html>

实际上 javascript 文件没有正确加载到您的 jsp 文件中,因此请在 url 中正确导航 .js 文件,正如我在上面的代码中输入的那样。

Just replace code with your code
于 2013-05-14T05:06:52.970 回答
0

好像您没有包含jQuery库,请尝试将其放在您的jtable链接之前:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" 
        type="text/javascript"></script>
于 2013-05-14T04:38:18.667 回答