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

📄 newspostresult.jsp

📁 基于JSP的公交查询系统,很好用的,适于学习,操作语句全在jsp页面里
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*"%>
<%@ page import="java.text.*"%>
<!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">
<!--
.style1 {	font-size: 16px;
	font-weight: bold;
}
body {
	background-image: url(../Picture/index-top_2.gif);
	margin-left: 30px;
}
-->
</style>
</head>

<body>

  <p>
      <%  String title=new String(request.getParameter("title").getBytes("ISO8859_1"),"GBK");
      String content=new String(request.getParameter("content").getBytes("ISO8859_1"),"GBK");
      String newstype=new String(request.getParameter("newstype").getBytes("ISO8859_1"),"GBK");
	  java.util.Calendar calendar = java.util.Calendar.getInstance();
      java.text.SimpleDateFormat formatter1 = new java.text.SimpleDateFormat("yyyy-MM-dd");
      String strDate = formatter1.format(calendar.getTime());
	  int type=0;
       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="insert into News(Title,Content,PostTime,Type) values ('"+title+"','"+content+"','"+strDate+"',"+type+")";
               sql.executeUpdate(condition); 
               
	          
		     
		   
		    }
        
		    catch (Exception e){
		    	
		    	e.printStackTrace();
		    }
		    	
	  %>
</p>
  <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="newspost.jsp" target="_self">点击这里</a></div></td>
    </tr>
    <tr>
      <td background="../Picture/bottombg.gif">&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp; </p>
</body>
</html>

⌨️ 快捷键说明

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