jsp文章內容管理與刪除代碼

來源:互聯網
上載者:User

jsp文章內容管理與刪除代碼
<br />
&nbsp; 需求資訊管理
<hr color="#0099FF" size="1" />
<%
String op;
String delID = request.getParameter("ID");
op = request.getParameter("op");
if(op==null){
 op = "my";
}

if (request.getParameter("submitedit") !=null){
 String namea=new String(request.getParameter("name").getBytes("iso-8859-1"));
 String notea=new String(request.getParameter("note").getBytes("iso-8859-1"));
 String linka=new String(request.getParameter("link").getBytes("iso-8859-1"));
 String pica=new String(request.getParameter("img").getBytes("iso-8859-1"));
 Statement stmt_ADD=conn.createStatement();
 stmt_ADD.executeUpdate("Update hl_links Set Name='"+namea+"',Noten='"+notea+"',Link='"+linka+"',pic='"+pica+"' where ID="+delID);
 stmt_ADD.close();
 out.print("<script type="text/javascript"> alert("您的設定已成功!"); window.location.href='xq_manage.jsp'; </script>"); 
return ;
}
if (op.equals("del") && delID!=null){

 Statement stmt_ChannelDEL=conn.createStatement();
 String Sql="delete from hl_msg where ID="+delID;
 int shan=stmt_ChannelDEL.executeUpdate(Sql);
  if (shan>0){
   out.print("<script type="text/javascript"> alert("已成功刪除!"); window.location.href='xq_manage.jsp'; </script>"); 
  }
 stmt_ChannelDEL.close();

 return ;
}
if (op.equals("look") && delID!=null){
 Statement stmte=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
 String Sqle="Select * from hl_msg where ID="+delID;
 ResultSet Rse=stmte.executeQuery(Sqle);
 if(Rse.next()) {
%>
<table width="80%" height="156" border="1" align="center"  bordercolor="#d5d3d4"   style=" margin-top:10px;BORDER-COLLAPSE: collapse;" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="87" align="right"  bgcolor="#F3F3F3">需求產品:</td>
                      <td width="274" height="32" align="left"  bgcolor="#F3F3F3" class="f-12-red"><span >&nbsp;
      <%=Rse.getString("ssname")%></span> — <span >
                      <%=Rse.getString("product")%>
                      </span></td>
                    </tr>
                    <tr>
                      <td width="87" align="right" >需求量:</td>
                      <td height="32" align="left" >&nbsp;
                          <%=Rse.getString("xq")%></td>
                    </tr>
                    <tr>
                      <td width="87" align="right" bgcolor="#F3F3F3" >連絡人:</td>
                      <td height="32" align="left" bgcolor="#F3F3F3" >&nbsp;
                          <%=Rse.getString("name")%></td>
                    </tr>
                    <tr>
                      <td width="87" align="right" >聯絡電話:</td>
                      <td height="32" align="left" >&nbsp;
                          <%=Rse.getString("tel")%></td>
                    </tr>
                    <tr>
                      <td width="87" align="right" bgcolor="#F3F3F3" >聯絡地址:</td>
                      <td height="32" align="left" bgcolor="#F3F3F3" >&nbsp;
                          <%=Rse.getString("address")%>
                          </label></td>
                    </tr>
                    <tr>
                      <td width="87" height="58" align="right" >簡要說明:</td>
                      <td align="left" ><label> &nbsp;&nbsp;
                            <%=Rse.getString("resumes")%>
                      </label></td>
                    </tr>
                  
                      <tr>
                        <td style="padding-left:260px" height="58" colspan="2" bgcolor="#F3F3F3">
       <a href="javascript:history.go(-1);">返回</a>  <A href="xq_manage.jsp?ID=<%=Rse.getInt("Id")%>&op=del">刪除</a>
                        </td>
                      </tr>

                </table>

<%
 }
 Rse.close();
 stmte.close();
 return ;
}
if (op.equals("add")){
%>
<form name="form1" method="post" action="">
            <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#ECF5FF">
                <tr >
                  <td width="21%" height="30" align="center" bgcolor="#ECF5FF"> 網站名稱</td>
                  <td height="30" colspan="2" bgcolor="#ECF5FF">
<input type="text" name="name" size="35" maxlength="40">                  </td>
                </tr>
                <tr>
                  <td height="30" align="center" bgcolor="#ECF5FF">網站介紹</td>
                  <td height="30" colspan="2" bgcolor="#ECF5FF">
<input type="text" name="note" size="50" maxlength="120">                  </td>
                </tr>
                <tr>
                  <td height="30" align="center" bgcolor="#ECF5FF"> 串連地址</td>
                  <td height="30" colspan="2" bgcolor="#ECF5FF">
<input type="text" name="link" size="40" maxlength="50" value="http://">                  </td>
                </tr>
              <tr  bgcolor="#BBDAFF">
            <td height="36" align="center" bgcolor="#ECF5FF">相關圖片:</td>
            <td width="22%" height="36" bgcolor="#ECF5FF"><input name="img" type="text" size="20">&nbsp;&nbsp;</td>
            <td width="57%"  align="left" valign="center" bgcolor="#ECF5FF"><iframe style="top:2px" name="ad" src="../upload.htm" frameborder=0 scrolling=no width="100%" height="30"> </iframe></td>
              </tr>
             
                <tr align="center" bgcolor="#A4B6D7">
                  <td height="30" colspan="3" bgcolor="#ECF5FF">
      <input type="hidden" name="addnew" value="true" />
                  <input type="submit" name="Submit" class="Submit" value="提交">&nbsp;&nbsp;&nbsp; <input type="reset" name="Submit2" class="Submit"  value="重設">                  </td>
                </tr>
              </table>
    </form>
<%
 return ;
}
%>

<div align="center">
<table width="600" border="0" cellspacing="1" bgcolor="#CCCCCC">
 <tr height="20" bgcolor="#FFFFFF">
  <td width="100" >連絡人</td>
  <td width="100" >聯絡電話</td>
  <td width="100" >需要產品</td>
  <td >需求量</td>
  <td width="100" >管  理</td>
 </tr>

 <%
int pageSize=10;  //每頁顯示的文章數
int showPage=1;   //當前頁面顯示的頁號
int recCount=0;   //ResultSet中的文章總數
int pageCount=0;  //分頁後的總頁數
String toPage = request.getParameter("page");
 Statement stmt3=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
 String Sql3="Select * from hl_msg";
 ResultSet RsF=stmt3.executeQuery(Sql3);
 if(RsF.next()) {
 RsF.last();
 recCount=RsF.getRow();
 pageCount=((recCount%pageSize)==0?(recCount/pageSize):(recCount/pageSize)+1);
 if(toPage!=null)
  showPage=Integer.parseInt(toPage);
  RsF.absolute((showPage-1)*pageSize+1);
 for(int i=1;i<=pageSize;i++){
  int ID = RsF.getInt("Id");

 %>
 <tr bgcolor="#FFFFFF" onmouseover="this.bgColor='#f0f8ff';" onmouseout="this.bgColor='#FFFFFF';">
  <td ><%=RsF.getString("name")%></td>
  <td ><%=RsF.getString("tel")%></td>
  <td ><%=RsF.getString("product")%></td>
  <td ><%=RsF.getString("xq")%></td>
  <td ><a href="xq_manage.jsp?ID=<%=ID%>&op=look">查看</a> | <a href="xq_manage.jsp?ID=<%=ID%>&op=del" onclick="return confirm('刪除後將不能恢複,你確定刪除嗎?')">刪除</a></td>
 </tr>
  <%
 if(!RsF.next())
  break;
 }
}
%>
</table>
      <table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td><div align="center"><br/>
              <a class='f-12-black'>總共&nbsp;<%=recCount%>&nbsp;條記錄&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第<%= showPage %>/<%=pageCount%>頁</a>&nbsp;&nbsp;<% if (showPage>1) { %><a class='f-12-black' href='xq_manage.jsp?page=<%= showPage-1 %>'>上一頁</a>&nbsp;<% } if (showPage<pageCount) { %>&nbsp;<a class='f-12-black' href='xq_manage.jsp?page=<%= showPage+1 %>'>下一頁</a>&nbsp;<% } %>&nbsp;<a class='f-12-black' href='xq_manage.jsp?page=<%=pageCount %>'>最後一頁</a>&nbsp;<a class='f-12-black'>去第<select name='sel_page' onChange='javascript:location=this.options[this.selectedIndex].value;'><%  for(int i=1;i<=pageCount;i++){  %> <option value='xq_manage.jsp?page=<%=i %>' <% if(i==showPage){ %>selected <% } %>><%=i %></option><% } %></select>頁</a>
            </div></td>
        </tr>
      </table>
</div>
<%
RsF.close();
stmt3.close();
conn.close();
%>

</body>
</html>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.