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

📄 tolist.jsp

📁 ssh整合在一起的例子.适合初学者,希望对大家能有一定的帮助作用
💻 JSP
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/util.tld" prefix="util" %>



<script language="javascript">
 

 function toAdd(){
 	document.crud.mhd.value="toAdd";
 } 
 
 function toUpdate(){
 	document.crud.mhd.value="toUpdate";
 }
 
 function doDelete(){
  if(confirm("你确认删除此条信息么?")){
 	 document.crud.mhd.value="doDelete";
  }
 }
 
 function doSelect(){
 	document.crud.mhd.value="doSelect";
 }
</script>

<bean:define id="context" value="<%=request.getContextPath()%>"/>
<bean:define id="total" name="total" type="java.lang.Integer" />
<bean:define id="perpage" name="perpage" type="java.lang.Integer"/>
<bean:define id="current" name="current" type="java.lang.Integer"/>

<html>
<head>
<link href="<%=context%>/css/font.css" type="text/css" rel="stylesheet" rev="stylesheet"/>

</head>
<body bgcolor="#ffffff">

<h1 align="center">
to user List</h1>


<form action="<%=context%>/user.do" method="post" name="form1" id="form1" onSubmit="JavaScript:return checkForm(this);">
<table width="752" border="0" align="center">
  <tr>
    <td class="font12g18h"><label> </label>
        <div align="center">
		  <input type="hidden" name="mhd" value="toList"/>
        <select name="conditionName" class="font12g18h">
          <option value="id">编号</option>
          <option value="username">账号名</option>
        </select>
        <select name="conditionOperator" class="font12g18h">
          <option value="-1">请选择</option>
          <option value="=">=</option>
          <option value="like">模糊</option>
          <option value=">">&gt;</option>
          <option value=">=">&gt;=</option>
          <option value="&lt;">&lt;</option>
          <option value="<=">&lt;=</option>
          <option value="!=">!=</option>
        </select> 
        值:
         <input name="conditionValue" type="text" class="inputkuan" size="15" /> 
         <input name="Submit" type="submit" class="font12g18h" value="查 询"/>
         <span class="font12r18h"><a href="user.do?mhd=toList">返回所有</a></span>
   <a href="<%=context%>/user.do?mhd=toAdd">增加</a></div></td>
  </tr>
 
</table>
 </form>
	<form name="crud" action="<%=context%>/user.do">
<input type="hidden" name="page">
<input type="hidden" name="mhd" value="toList">
<input type="hidden" name="strCondition" value="<logic:present name='strCondition' scope='request'><bean:write name='strCondition' /></logic:present>"/>
</form>

<form name="crud" action="<%=context%>/user.do" method="post">
  <table width="550" border="0" align="center" class="font12g18h">
  <tr >
    <td width="115" class="font12g18h"><div align="center">编号</div></td>
    <td width="197" class="font12g18h"><div align="center">用户名</div></td>
    <td width="167" class="font12g18h"><div align="center">密  码</div></td>
    <td width="124" class="font12g18h"><div align="center">操 作</div></td>
  </tr>
  <logic:present name="users" scope="request">
  <logic:iterate name="users" id="user" scope="request" type="com.softdevelopstudio.domain.User">
  <tr>
    <td>&nbsp;
      <div align="center">
		
	<a href="<%=context%>/user.do?mhd=toView&id=<bean:write name='user' property='id'/>">
		<bean:write name="user" property="id"/>
	</a>
  	       </div></td>
    <td>&nbsp;
      <div align="center">
        <bean:write name="user" property="username"/>
      </div></td>
    <td>&nbsp;
        <div align="center">
          <bean:write name="user" property="password"/>
      </div></td>
    <td><table width="77%" border="0" align="center">
      <tr>
        <td width="44%" class="font12g18h"><a href="<%=context%>/user.do?mhd=toUpdate&id=<bean:write name='user' property='id'/>">更新</a></td>
        <td width="12%" class="font12g18h"><div align="center">|</div></td>
        <td width="44%"><div align="center"><a href="<%=context%>/user.do?mhd=doDelete&id=<bean:write name='user' property='id'/>" onClick="JavaScript:return confirmDelete();">删除</a></div></td>
      </tr>
    </table></td>
    </tr>
  </logic:iterate>
  </logic:present>
</table>
</form>
 <table width="780" height="30" border="0" cellpadding="0" cellspacing="0"  class="ge5p">
                <tr>
                  <td align="right" valign="middle" class="font12w18h_1">
 <util:paginateNewVersion all="<%=total.intValue()%>" context="<%=context%>" current="<%=current.intValue()%>" perpage="<%=perpage.intValue()%>"/>
 <form name="nextpage" action="<%=context%>/user.do">
                              <input type="hidden" name="page">
                              <input type="hidden" name="mhd" value="toList">

<input type="hidden" name="strCondition" value="<logic:present name='strCondition' scope='request'><bean:write name='strCondition' /></logic:present>"/>
</form>
 </td>
                </tr>
              </table>
<script language="javascript">
	function checkForm(selectForm){
		if(selectForm.conditionName.value=="-1"){
			alert("请选择查询内容!");
			return false;
		}else if(selectForm.conditionOperator.value=="-1"){
			alert("请选择操作符!");
			return false;
		}else if(selectForm.conditionValue.value==""){
			alert("请输入值!");
			return false;
		}else{
			//selectForm.submit();
			return true;
		}
	}
	
	function confirmDelete(){
		if(confirm("你确定删除吗?")){
			return true;
		}
		else{
			return false;
 		}
    }
</script>

<script language="JavaScript">
	 function go(page){
	   document.nextpage.page.value=page;
	   document.nextpage.submit();
	 }
	 function change(page){
	   document.nextpage.page.value=page;
	   document.nextpage.mhd.value='toList';
	   document.nextpage.submit();
	 }
 </script>
</body>
</html>

⌨️ 快捷键说明

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