打印本文 打印本文  关闭窗口 关闭窗口
使用JSP + JAVABEAN + XML 开发的一个例子
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005/9/10 14:29:01
)){
         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 
        onClick="javascript:if(confirm('您是否确定删除本记录,删除后将导至记录无法使用?')){window.location.href='<%=request.getRequestURI()%>?act=del&recordId=<%=restaurant.getAttributeNode("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"  onSubmit='return checkform2(this);' >
        <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 onClick="javascript:if (checkform2()==false);" type=button value="更新记录">
              <% }else{
                if(strOperation=="modi"){
              %>
              <input class=stbtm name=update onClick="javascript:if (checkform()==false);" type=button value="更新记录">
              <% 
                }else{
                 %>
              <input class=stbtm type="button" name="Button" value="新 增" onClick="javascript:window.location.href='<%=request.getRequestURI()%>?act=addnew';"><% 
                } 
               } %>
               </td>
            <td>
              <input class=stbtm type="button" name="Button" value="返 回" onClick="javascript:window.location.href='index.jsp';">
            </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()
{  
 var Checkblank = /^(s*|( )|(.))*$/;
 if (Checkblank.test(dataform.name.value))
 {
          alert("餐馆名称不能为空!");
          dataform.name.focus();
   return false; 
         }
         
         if (Checkblank.test(dataform.phone.value))
 {
          alert("餐馆电话不能为空!");
          dataform.phone.focus();
   return false; 
         }
        

         window.dataform.submit(

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



打印本文 打印本文  关闭窗口 关闭窗口