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

📄 newsmodifyresult.jsp

📁 基于JSP的公交查询系统,很好用的,适于学习,操作语句全在jsp页面里
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改新闻</title>
<style type="text/css">
<!--
body {
	background-image: url(../Picture/index-top_2.gif);
	margin-left: 50px;
}
.style1 {
	font-size: 16px;
	font-weight: bold;
}
-->
</style></head>

<body>
 
  <%  int newsid=Integer.parseInt(request.getParameter("newsid"));
      String title=new String(request.getParameter("title").getBytes("ISO8859_1"),"GBK");
	  String posttime=new String(request.getParameter("posttime").getBytes("ISO8859_1"),"GBK");
      String content=new String(request.getParameter("content").getBytes("ISO8859_1"),"GBK");
	  String newstype=new String(request.getParameter("type").getBytes("ISO8859_1"),"GBK");
      int type;
      if(newstype.equals("新闻快递"))
	       type=1;
        else
             type=0; 
     Statement sql=null;
	  
	  Connection con=null;
	    
		     
		    try{  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		         }
		   catch(ClassNotFoundException e){
			                      e.printStackTrace();
		                           }
	  try{      con=DriverManager.getConnection("jdbc:odbc:nbos","","");
		      
		      
                sql=con.createStatement();
                String condition="update News set Title='"+title+"',PostTime='"+posttime+"',Content='"+content+"',Type="+type+" where NewsID="+newsid+"";
                sql.executeUpdate(condition); 
               %>
  <table width="302" height="81" border="1">
    <tr>
      <td width="239" height="20" background="../Picture/topbg.gif"><div align="center"><span class="style1">新闻修改成功!</span></div></td>
    </tr>
    <tr>
      <td height="29" background="../Picture/l33.gif"><div align="center">如果想继续修改,请<a href="newsmodify.jsp" target="_self">点击这里</a></div></td>
    </tr>
    <tr>
      <td background="../Picture/bottombg.gif">&nbsp;</td>
    </tr>
  </table>
	           
		    
		   <%
		    }
        
		    catch (Exception e) {
		    	
		    	e.printStackTrace();
		       }
		    	
	  %>

</body>
</html>

⌨️ 快捷键说明

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