使用IDEA学习JSP代码第017课

new363.java

package pack03;

import com.sun.rowset.CachedRowSetImpl;

public class new363
{
    /**
     *  存储表中全部记录集对象
     *  每页显示记录数
     *  分页后的总页数
     *  当前页
     *  显示当前页内容
     * */
    private CachedRowSetImpl rowSet = null;
    private int pageSize = 10;
    private int pageAllCount = 0;
    private int showPage = 1;
    private StringBuffer presentPageResult;

    public CachedRowSetImpl getRowSet()
    {
        return rowSet;
    }

    public void setRowSet(CachedRowSetImpl rowSet)
    {
        this.rowSet = rowSet;
    }

    public int getPageSize()
    {
        return pageSize;
    }

    public void setPageSize(int pageSize)
    {
        this.pageSize = pageSize;
    }

    public int getPageAllCount()
    {
        return pageAllCount;
    }

    public void setPageAllCount(int pageAllCount)
    {
        this.pageAllCount = pageAllCount;
    }

    public int getShowPage()
    {
        return showPage;
    }

    public void setShowPage(int showPage)
    {
        this.showPage = showPage;
    }

    public StringBuffer getPresentPageResult()
    {
        return presentPageResult;
    }

    public void setPresentPageResult(StringBuffer presentPageResult)
    {
        this.presentPageResult = presentPageResult;
    }
}

new364.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>bootstrap + jsp 的使用</title>
    <link rel="stylesheet" href="../other/boot/css/bootstrap.min.css">
    <script type="text/javascript" src="../other/jQuery/jQuery-3.4.1.js"></script>
    <script type="text/javascript" src="../other/boot/js/bootstrap.min.js"></script>

</head>
<body>
<%@include file="new348.jsp"%>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <form class="form-horizontal" method="post" action="new367">
                <div class="form-group">
                    <label for="showPage" class="col-sm-2 control-label">分页显示全体会员:</label>
                    <div class="col-sm-10">
                        <input type="hidden" class="form-control" id="showPage" name="showPage" value="1" size="6">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">显示</button>
                    </div>
                </div>
            </form>
            <form class="form-horizontal" method="get" action="new367">
                <div class="form-group">
                    <label for="loginName" class="col-sm-2 control-label">输入要查找的会员名:</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="loginName" name="loginName">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">显示</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>

new365.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="pack03.new363" %>
<jsp:useBean id="show" type="pack03.new363" scope="session"/>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>bootstrap + jsp 的使用</title>
    <link rel="stylesheet" href="../other/boot/css/bootstrap.min.css">
    <script type="text/javascript" src="../other/jQuery/jQuery-3.4.1.js"></script>
    <script type="text/javascript" src="../other/boot/js/bootstrap.min.js"></script>

</head>
<body>
<%@include file="new348.jsp"%>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <p>显示会员信息</p>
            <br>每页最多显示<jsp:getProperty name="show" property="pageSize"/>条信息
            <br>当前显示第<strong><jsp:getProperty name="show" property="showPage"/></strong>页,共有<strong><jsp:getProperty name="show" property="pageAllCount"/></strong>页。
            <br>当前显示的内容是:
            <table class="table table-bordered">
                <tr>
                    <th>编号</th>
                    <th>会员名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>电话</th>
                    <th>邮箱</th>
                    <th>简介</th>
                    <th>图片</th>
                </tr>
                <jsp:getProperty name="show" property="presentPageResult"/>
            </table>
            <br>单击“前一页” 或 “下一页” 按钮查看信息
            <table>
                <tr>
                    <td>
                        <form action="new367" method="post">
                            <input type="hidden" name="showPage" value="<%= show.getShowPage() - 1 %>">
                            <input type="submit" name="g" value="前一页">
                        </form>
                    </td>
                </tr>
                <tr>
                    <td>
                        <form action="new367" method="post">
                            <input type="hidden" name="showPage" value="<%= show.getShowPage() + 1 %>">
                            <input type="submit" name="g" value="后一页">
                        </form>
                    </td>
                </tr>
                <tr>
                    <td>
                        <form action="new367" method="post">
                            输入页码:<input type="text" name="showPage">
                            <input type="submit" name="g" value="提交">
                        </form>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

虾米大王

有你的支持,我会更有动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值