统计在线人数...

使用JSP + JAVABEAN + XML 开发的一个例子

[ 来源:ASP教程 | 作者:admin | 时间:2002-12-25 上午 10:19:42 | 浏览:统计中... ]

arset=gb2312">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" href="../../include/itsp.css" type="text/css">
</head>

<body >
<div align="center">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" height="22">
    <tr> 
      <td width="1"><img src="../../images/top_r1.GIF" width="62" height="22"></td>
      <td width=150 align="center"> 餐饮系统管理--餐馆管理</td>
      <td><img src="../../images/top_r2.GIF" width="294" height="22"></td>
   <td width=100 align="center"><a href="/index.html">[ 退出系统 ]</a></td>
    </tr>
  </table>
  <br>
  <br>
  <table bgcolor="#999999" align=center border=0 cellpadding=1 cellspacing=1 
width="90%">
    <tbody> 
    <tr bgcolor="#efefef" align="center" valign="middle"> 
      <td class=ttTable height=30 width="20"> </td>
      <td class=ttTable height=30 width="0">餐馆名称</td>
      <td class=ttTable height=30 width="0">餐馆电话</td>
      <td class=ttTable height=30 width="0"> 
        <div align="center">餐馆地址</div>
      </td>
      <td class=ttTable height=30 width="30"> 
        <div align="center">修改</div>
      </td>
      <td class=ttTable height=30 width="30"> 
        <div align="center">删除</div>
      </td>
    </tr>
<%
 for(int i=0;i<restaurants.getLength();i++)
 {
  Element restaurant=(Element) restaurants.item(i);
  
  if (strOperation=="modi" && Integer.parseInt(restaurant.getAttributeNode("id").getNodeValue())==intId){
%>
    <%//显示修改的格式%>
    <tr align="center" bgcolor="#ffffff" valign="middle"> 
      <form name=dataform action="<%=request.getRequestURI()%>?act=modiDo" method="post"   >
        <td class=tdsmall height=25 width="20"> 
          <input type="hidden" name="recordId" value="<%=restaurant.getAttributeNode("id").getNodeValue()%>">
          <%=(i+1)%></td>
        <td class=tdsmall height=25> 
          <input name="name" class=stedit
                  style="HEIGHT: 22px; WIDTH: 150px" value="<%if(restaurant.getElementsByTagName("name").item(0).hasChildNodes()){
         out.print(restaurant.getElementsByTagName("name").item(0).getFirstChild().getNodeValue());
         
        }%>
" maxlength="40" >
        </td>
        <td class=tdsmall height=25> 
          <input name="phone" class=stedit
                  style="HEIGHT: 22px; WIDTH: 100px" value="<%if(restaurant.getElementsByTagName("phone").item(0).hasChildNodes()){
         out.print(restaurant.getElementsByTagName("phone").item(0).getFirstChild().getNodeValue());
         
        }%>" maxlength="20" >
        </td>
        <td class=tdsmall height=25> 
          <input name="address" class=stedit
                  style="HEIGHT: 22px; WIDTH: 200px" value="<%
                  
                  if(restaurant.getElementsByTagName("address").item(0).hasChildNodes()){
         out.print(restaurant.getElementsByTagName("address").item(0).getFirstChild().getNodeValue());
         
        }%>" maxlength="100" >
        </td>
        <td class=tdsmall height=25 width="25"><a href="javascript:if (checkform()==false);"><img border=0 
      height=15 src="../../images/editok.gif" width=15></a></td>
        <td class=tdsmall height=25 width="25"> </td>
      </form>
    </tr>
    <% }else{ 
    //显示正常的格式 %>
    <tr align="center" bgcolor="#ffffff" valign="middle"> 
      <td class=tdsmall height=25 width="20"><%=(i+1)%></td>
      <td class=tdsmall height=25 width="0"><%if(restaurant.getElementsByTagName("name").item(0).hasChildNodes()){
         out.print(restaurant.getElementsByTagName("name").item(0).getFirstChild().getNodeValue());
         
        }%>
</td>
      <td class=tdsmall height=25 width="0"><%if(restaurant.getElementsByTagName("phone").item(0).hasChildNodes()){
         out.print(restaurant.getElementsByTagName("phone").item(0).getFirstChild().getNodeValue());
         
        }%></td>
      <td class=tdsmall height=25 width="0"> 
        <%
        if(restaurant.getElementsByTagName("address").item(0).hasChildNodes()){
        out.print(restaurant.getElementsByTagName("address").item(0).getFirstChild().getNodeValue());
         
        }%>
      </td>
      <td class=tdsmall height=25 width="30"><a href="<%=request.getRequestURI()%>?act=modi&recordId=<%=restaurant.getAttributeNode("id").getNodeValue()%>"><img border=0 
        height=15 src="../../images/edit.gif" width=15></a></td>
      <td class=tdsmall height=25 width="30"><img border=0 
        height=15 
        id").getNodeValue()%>'';}" 
        src="../../images/delete.gif" style="CURSOR: hand" width=15> </td>
    </tr>
    <% } 
}%>
    <% if (strOperation=="addnew"){
    //显示新增的格式%>
    <tr align="center" bgcolor="#ffffff" valign="middle"> 
      <form name=dataform2 action="<%=request.getRequestURI()%>?act=addnewDo" method="post"   >
        <td class=tdsmall height=25 width="20"></td>
        <td class=tdsmall height=25> 
          <input name="name" class=stedit
                  style="HEIGHT: 22px; WIDTH: 150px" value="" maxlength="40" >
        </td>
        <td class=tdsmall height=25> 
          <input name="phone" class=stedit
                  style="HEIGHT: 22px; WIDTH: 100px" value="" maxlength="20" >
        </td>
        <td class=tdsmall height=25> 
          <input name="address" class=stedit
                  style="HEIGHT: 22px; WIDTH: 200px" value="" maxlength="100" >
        </td>
        <td class=tdsmall height=25 width="25"><a href="javascript:if (checkform2()==false);"><img border=0 
      height=15 src="../../images/editok.gif" width=15></a></td>
        <td class=tdsmall height=25 width="25"> </td>
      </form>
    </tr>
    <% } %>
    </tbody> 
  </table>
  <br>
  <table align=center border=0 cellpadding=0 cellspacing=2 width="95%">
    <tbody> 
    <tr valign=center> 
      <td align=middle> <br>
        <table border=0 cellpadding=0 cellspacing=0>
          <tr>
            <td> 
              <% if (strOperation=="addnew"){
              %>
              <input class=stbtm name=update  type=button value="更新记录">
              <% }else{
                if(strOperation=="modi"){
              %>
              <input class=stbtm name=update  type=button value="更新记录">
              <% 
                }else{
                 %>
              <input class=stbtm type="button" name="Button" value="新 增" ><% 
                } 
               } %>
               </td>
            <td>
              <input class=stbtm type="button" name="Button" value="返 回" >
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <p> </p>
</div>
</body>
</html>
<SCRIPT LANGUAGE=javascript>
<!--
function checkform2()
{
 var Checkblank = /^(\s*|(\ )|(\.))*$/;
  
  if (Checkblank.test(dataform2.name.value))
 {
          alert("餐馆名称不能为空!");
          dataform2.name.focus();
   return false; 
         } 
 
  if (Checkblank.test(dataform2.phone.value))    
 {
          alert("餐馆电话不能为空!");
          dataform2.phone.focus();
   return false; 
         }
         window.dataform2.submit();
  }
  
  function checkform()
{  
 va

上一页  [1] [2] [3] [4] [5]  下一页

共有1人参与评价,平均得分:85分
评论内容只代表网友观点,与本站立场无关! 查看完整内容
   

游客于 2008-1-8 下午 05:30:36 发表评论,打分:85,IP:58.20.100.16

goog 

当前在线人数
QQ:748838 MSN:allen_xia#msn.com E-mail:allenxia666#126.com QQ群:站长联盟北方区-北京(28200145) 站长联盟南方区-上海(67713522)