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

📄 newsmodifydisplay.jsp

📁 基于JSP的公交查询系统,很好用的,适于学习,操作语句全在jsp页面里
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript">
function checkdata(){
     
	 content=document.modify.content.value;
	 title=document.modify.title.value;
     posttime=document.modify.posttime.value;
	 if(title.length<5)	
	     {  alert('新闻标题不能小于5个字段');
		    return false;
		 }
	
    if(posttime.length<6)	 
	     { alert("发布时间不能小于6个字段")	;
		   return false;
		   }	 
    if(content.length<10)	 
	     { alert("新闻内容不能小于10个字段")	;
		   return false;
		   }	  
   }
</script>

<title>信息显示</title>
<style type="text/css">
<!--
body {
	background-image: url(../Picture/index-top_2.gif);
}
.STYLE1 {
	font-weight: bold;
	font-size: 18px;
}
.STYLE2 {
	font-size: 14px;
	font-weight: bold;
}
-->
</style><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>

<body>

<%  
    
	int i=0;
    String content="";
    String posttime="";
    int newsid=0;
    Connection con;
    String statement="";
	ResultSet result;
	String title= new String(request.getParameter("title").getBytes("ISO8859_1"),"GBK");
	
 try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	     }
		catch(ClassNotFoundException e){}
		 
	try{  
	      con=DriverManager.getConnection("jdbc:odbc:nbos","","");
	      Statement sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); 
		  statement="select * from News where Title='"+title+"'";
		  result=sql.executeQuery(statement);
		  if(result.next())
		      { newsid=result.getInt("NewsID");
			    content=result.getString("Content");
			    posttime=result.getString("PostTime");
	            
			    i++;
			  }  
		%>
<form name="modify" method="post" action="newsmodifyresult.jsp?newsid=<%=newsid%>" OnSubmit="return checkdata();">		
 <table background="../Picture/l33.gif" width="686"  align="left">
    <tr background="../Picture/topbg.gif">
      <td colspan="4" background="../Picture/topbg.gif"><div align="center" class="STYLE1">修改新闻信息</div></td>
    </tr>
    <tr background="../Picture/l33.gif">
      <td height="18"><div align="center">新闻标题:</div></td>
      <td height="18" colspan="2"><input name="title" type="text" size="25" value="<%=title%>"></td>
      <td height="18">&nbsp;</td>
    </tr>
    <tr background="../Picture/l33.gif">    </tr>
    <tr background="../Picture/l33.gif">
      <td height="18"><div align="center">发布时间:</div></td>
      <td height="18" colspan="2"><input type="text" name="posttime" value="<%=posttime%>"></td>
      <td height="18">&nbsp;</td>
    </tr>
    <tr background="../Picture/l33.gif">    </tr>
    <tr background="../Picture/l33.gif">
      <td height="7"><div align="center">文章类型:</div></td>
      <td height="7" colspan="2"><select name="type">
        <option>新闻快递</option>
        <option>最新公告</option>
      </select></td>
      <td height="7">&nbsp;</td>
    </tr>
    <tr background="../Picture/l33.gif">    </tr>
    <tr background="../Picture/l33.gif">
      <td width="129" height="15"><div align="center">新闻内容:</div>
      <div align="left"></div></td>
      <td colspan="3" rowspan="2"><textarea name="content" cols="75" rows="15" ><%=content%></textarea>
           <div align="center"></div>            </td>
    </tr>
    <tr background="../Picture/l33.gif">
      <td height="150"><div align="right"></div>        <div align="right"></div></td>
    </tr>
    <tr background="../Picture/l33.gif">
      <td><p align="center"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></td>
      <td width="188">
        <div align="center">
          <input type="submit" name="Submit" value="修改" />
          
      </div>      </td>
      <td width="114">
        <div align="center">
          <input type="reset" name="reset" value="重置" />
      </div>      </td>
      <td width="235">&nbsp;</td>
    </tr>
    <tr>
      <td height="21" colspan="4" background="../Picture/bottombg.gif">&nbsp;</td>
    </tr>
</table>
</form>
 <%  result.close(); }
     catch(Exception e){ }   %>
</body>
</html>

⌨️ 快捷键说明

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