Struts 2在子JSP中使用JavaScript

时间:2019-02-20 23:05:13

标签: javascript jquery css jsp struts2

我正在尝试使用wenzhixin的bootstrap table扩展。在我的Web应用程序中,我有一个名为Assets.jsp的父页面以及其他名称的子页面。 现在,当我在Assets.jsp中创建表时没有问题,那么,如果我在子页面之一中创建表,则该表将显示没有样式和过滤器,仅显示html简单表。

示例:如果我将表格放在Assets.jsp

<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.13.1/bootstrap-table.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.13.1/bootstrap-table.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.13.1/locale/bootstrap-table-zh-CN.min.js"></script>

<table id="table" data-toggle="table" data-search="true" data-filter-control="true" data-show-export="true" class="table-responsive">
  <thead>
    <tr>
      <th data-sortable="true" data-filter-control="input">Firstname</th>
      <th data-sortable="true" data-filter-control="input">Lastname</th>
      <th data-sortable="true" data-filter-control="input">Email</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John</td>
      <td>Doe</td>
      <td>john@example.com</td>
    </tr>
    <tr style="">
      <td>Mary</td>
      <td>Moe</td>
      <td>mary@mail.com</td>
    </tr>
    <tr style="">
      <td>July</td>
      <td>Dooley</td>
      <td>july@greatstuff.com</td>
    </tr>
    <tr style="">
      <td>Anja</td>
      <td>Ravendale</td>
      <td>a_r@test.com</td>
    </tr>
  </tbody>
</table>

Jsfiddle example

否则,如果我将表放到AssetsContent.jsp中,那是Assets.jsp的子级,并包含在<s:include value="AssetsContent.jsp" />的正文页中。我明白了

Jsfiddle example2

我该怎么办?谢谢。

1 个答案:

答案 0 :(得分:0)