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

📄 province_list.jsp

📁 该项目基于mvc模式
💻 JSP
字号:
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>add provinces</title>
</head>
<script type="text/javascript">
  function form1_submit()
  {
    if(document.form1.name.value=="")
    {
      alert("请输入省名称");
      document.form1.name.focus();
      return false;
    }
     else
   {
    window.alert("恭喜你,添加成功");
    return true;
   }
    form1.submit();
  }
  </script>
  <SCRIPT type="text/javascript">
    function jump(input)
    {
      if(input.value==${p.currentPage})
      { 
      return;
      }
      var url="province.do?dispatch=list&page="+input.value;
      document.location=url;
    } 
</SCRIPT>
<body>
<center>
<table>
<tr><td>省名</td> <td>操作</td></tr>

<logic:present name="ProvinceList">
<logic:notEmpty name="ProvinceList">
<logic:iterate id="province" name="ProvinceList">
<tr><td><c:out value="${province.name}"/></td><td><a href="province.do?dispatch=delete&id=${province.id}" />delete</a></td></tr>
</logic:iterate>
</logic:notEmpty>
<logic:empty name="ProvinceList">
<tr><td> 无记录</td><td></td></tr>
</logic:empty>
</logic:present>


</table>
<table>
<tr>
<td>
<a href="province.do?dispatch=list&page=1">首页</a>


<c:if test="${p.currentPage>1}">
<a href="province.do?dispatch=list&page=${p.currentPage-1}"> [前页]</a>
</c:if>

<c:if test="${p.currentPage<=1}">
[前页]
</c:if>

<c:if test="${p.currentPage<p.totalpages}">
<a href="province.do?dispatch=list&page=${p.currentPage+1}"> [后页]</a>
</c:if>

<c:if test="${p.currentPage>=p.totalpages}">
[后页]
</c:if>

<a href="province.do?dispatch=list&page=${p.totalpages }">尾页</a>

第<font color="red">${p.currentPage }</font>页/共<font color="red">${p.totalpages }</font>页 
转到<SELECT onchange="jump(this)">
    <c:forEach var="i" begin="1" end="${p.totalpages}">
    <option value="${i}" 
     <c:if test="${p.currentPage==i}">
        selected
     </c:if>
     
    >第${i}页</option>
    </c:forEach>
</SELECT>
输入页码:<input type="text" size="4" value="${p.currentPage}" id="jumpbox"><input type="button" value="跳 转"
onclick="jump(document.getElementById('jumpbox'))"
>
</td>
</tr>
</table>

<form name="form1" action="province.do?dispatch=save" method="post"
	onSubmit="return form1_submit();">
<table>
	<tr>
		<td>省名:</td>
		<td><input type="text" name="name" value=""></td>
		<td></td>
	</tr>
	<tr>
		<td><input type="submit" value="注册"></td>
		<td><input type="reset" value="重置"></td>
		<td><a href="city.do?dispatch=addView">添加城市名</a></td>
	</tr>	
</table>
</form>
</center>
</body>
</html>

⌨️ 快捷键说明

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