⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 select.jsp

📁 jsp+servlet+javaBean实现MVC
💻 JSP
字号:
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<html>
<head>
<title>select</title>
<script type="javaScript">
function submitForm()
{
	if(document.form1.selectValue.value=="")
        {
           alert("请输入查找关键字");
           document.form1.selectValue.focus();
           return false;
        }else
        {
          return true;
        }
}
function toPage()
{
  if(document.form1.pageText.value=="")
  {
            alert("请输入要前往的页数");
           document.form1.pageText.focus();
           return false;
  }else
        {
          a=document.form1.pageText.value;
          if(a<=0||a>=${requestScope.pagecount})
             a=${requestScope.page}
          document.form1.action = "selectservlet?page="+a+"&selectValue=${requestScope.selectValue}";
          return true;
        }
}
</script>
</head>
<body bgcolor="#ffffff">
<jsp:include flush="false" page="index.jsp"/>
<center>
  <form name="form1" action="selectservlet" method="POST" onreset="javascript:document.form1.selectValue.value=${requestScope.selectValue}">
  <table>
    <tr>
      <td>输入查询的关键字</td>
      <td>
        <input type="text" name="selectValue" value="${requestScope.selectValue}"/>
      </td>
      <td>
        <input type="submit" onclick="submitForm()" value="查询"/>
        <input type="button" onclick="selectAll()" value="察看全部"/>
      </td>
    </tr>
  </table>
  <c:if test="${not empty sessionScope.selectList}">
    <table border="1" cellpadding="3" cellspacing="3">
      <tr>
        <th>编号</th>
        <th>名字</th>
        <th>公司</th>
        <th>歌手</th>
        <th>类型</th>
        <th>操作</th>
      </tr>
      <c:forEach var="cdbean" items="${sessionScope.selectList}">
        <tr>
          <td>${cdbean.cdId}          </td>
          <td>${cdbean.cdName}          </td>
          <td>${cdbean.cdCompany}          </td>
          <td>${cdbean.cdAlbum}          </td>
          <td>${cdbean.cdType}          </td>
          <td>
            <a onclick="javascript:window.open('editservlet?id=${cdbean.cdId}','jszx','width=650,height=500,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');">编辑</a>
            &nbsp;
            <a onclick="javascript:window.open('del.jsp?id=${cdbean.cdId}','jszx','width=200,height=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');">删除</a>
          </td>
        </tr>
      </c:forEach>
    </table>
    <table>
      <tr>
        <td>
          <a href="selectservlet?action=frist&selectValue=${requestScope.selectValue}">首页</a>
        </td>
        <td>
          <c:if test="${requestScope.page==1}">上一页</c:if>
          <c:if test="${requestScope.page!=1}">
            <a href="selectservlet?action=next&page=${requestScope.page-1}&selectValue=${requestScope.selectValue}">上一页</a>
          </c:if>
        </td>
        <td>
          <c:if test="${requestScope.page==requestScope.pagecount}">下一页</c:if>
          <c:if test="${requestScope.page!=requestScope.pagecount}">
            <a href="selectservlet?action=next&page=${requestScope.page+1}&selectValue=${requestScope.selectValue}">下一页</a>
          </c:if>
        </td>
        <td>
          <a href="selectservlet?action=last&selectValue=${requestScope.selectValue}">尾页</a>
        </td>
        <td>${requestScope.page}          /
${requestScope.pagecount}        </td>
        <td>          转到
          <input type="text" size="2" name="pageText" onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
 value="${requestScope.page}"/>
          <input type="submit" onclick="toPage()" value="GO"/>
        </td>
      </tr>
    </table>
  </c:if>
  </form>
</center>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -