新闻发布项目——后台JSP界面adminManage/modifyNews.jsp

<%@page import="bdqn.newsManageServlet.Service.Impl.categoryTBServiceImpl"%>
<%@page import="bdqn.newsManageServlet.entity.categoryTB"%>
<%@page import="bdqn.newsManageServlet.Service.categoryTBService"%>
<%@page import="bdqn.newsManageServlet.entity.newsTb"%>
<%@page import="bdqn.newsManageServlet.Dao.newsTbDao"%>
<%@page import="bdqn.newsManageServlet.Dao.Impl.newsTbDaoImpl"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../CSS/admin.css" rel="stylesheet" type="text/css" />
<title>修改新闻</title>
</head>
<%
	//根据传过来的值获取将要修改的id
int newsid=0;
	if(request.getParameter("newsid")!=null){
	 newsid=Integer.parseInt(request.getParameter("newsid"));
	}
	//根据id查新闻信息
	newsTbDao ndao=new newsTbDaoImpl();
	newsTb ne=ndao.getAllNewsById(newsid);
%>
 
 <%
  	//接收错误信息
       	String msg =(String)request.getAttribute("msge");
       	if(msg==null){
       		msg="";
       	}
  %>
<body>
<%
	//根据类别id查询类别的名字
	categoryTBService cateService =new categoryTBServiceImpl();
	int categoryid=ne.getCategoryID();
	categoryTB cate=cateService.getCateById(categoryid);
	String categoryName=cate.getCategoryName();
%>
<form action="../doNewsModifyServlet" method="post" enctype="multipart/form-data">
<div id="opt_type">修改新闻</div>
<%
	//获取所有的类别名称
	List<categoryTB> catelist=cateService.getCategoryTBAll();
 %>
<input type="hidden" name="newsid" value="<%=ne.getNewsID() %>" />
            主题<select name="slt" class="classlist" 
             value="<%=categoryName%>">
			<%
				for(int i = 0; i < catelist.size(); i++) {
			%>
			<option
				<%if (categoryName.equals(catelist.get(i).getCategoryName())) {%>
				selected="selected" <%}%>><%=catelist.get(i).getCategoryName()%></option>
			<%
				}
			%>
		</select><br/>
            标题<input type="text" class="classlist" name="title" value="<%=ne.getTitle()%>"/><br/>
            作者<input type="text" class="classlist" name="author" value="<%=ne.getAuthor()%>"/><br/>
            摘要<textarea cols="30" rows="3" class="classlist" name="summary"><%=ne.getSummary()%></textarea><br/>
            内容<textarea cols="50" rows="6" class="classlist" name="content"><%=ne.getContent()%></textarea><br/>
           <img src="<%=ne.getPicPath()%>" alt="<%=ne.getPicPath()%>"/>
            <br/>
          修改图片<input type="file" class="classlist" name="picPath"/><br/> 
          <span style="color:red"><%
 	String uMsg = (String) request.getAttribute("mesg");
 	if (uMsg == null) {
 		out.print(""); 
 	} else {
 		out.print(uMsg);
 	}
 	%></span> 
            <input type="submit" value="提交" class="classlist"/>
            <input type="reset" value="重置" class="classlist"/>
       </form>
</body>
</html>

<%@page contentType="text/html"%> <%@page pageEncoding="GB2312"%> <%@page import = "java.sql.*" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>index</title> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); //--> </script> <style type="text/css"> <!-- .url { font-weight: bold; color: #666666; background-position: center; } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } .STYLE18 { font-size: 18px; font-family: "楷体_GB2312"; } .STYLE19 {font-size: 14px} .STYLE20 { font-size: 24px; font-weight: bold; } .STYLE21 {font-size: 18px} .STYLE22 {font-size: 10px} .STYLE23 {font-size: 12px} .STYLE24 {font-size: 16px; } body,td,th { font-size: 12px; } --> </style> <% Object obj=session.getAttribute("access") ; if (obj==null) session.setAttribute("access","n") ; if(request.getParameter("adminid") !=null && request.getParameter("adminpwd") != null){ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:database"); Statement smt =con.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); String getpaperdata = "SELECT * FROM admin WHERE adminid='" + request.getParameter("adminid") + "' AND adminpwd='" + request.getParameter("adminpwd") + "'" ; ResultSet paperrs =smt.executeQuery(getpaperdata) ; if(paperrs.next()){ String adminid=paperrs.getString("adminid"); String adminpwd=paperrs.getString("adminpwd"); session.setAttribute("access","y") ; session.setAttribute("adminid",adminid) ; session.setAttribute("adminpwd",adminpwd) ; session.setAttribute("accessid",request.getParameter("adminid")) ; session.setMaxInactiveInterval(1800) ; response.sendRedirect("newslist.jsp") ; }else response.sendRedirect("wrong.jsp") ; } %> </head> <body bgcolor="#666666" text="#006E45" link="#006E45" vlink="#006E45" alink="#006E45" topmargin="0"> <table width="976" height="699" border="1" align="center" bordercolor="#000000" bgcolor="#CCCCCC"> <td height="125" colspan="3" bgcolor="#CCFF00"><marquee behavior="scroll" scrollamount="6" scrolldelay="1"><img src="images/c6.jpg" width="161" height="175"><img src="images/c7.jpg" width="161" height="175"><img src="images/c8.jpg" width="161" height="175"><img src="images/c9.jpg" width="161" height="175"><img src="images/c10.jpg" width="161" height="175"><img src="images/c11.jpg" width="161" height="178"></marquee></td> <tr> <td width="202" height="226" rowspan="2" bgcolor="#CCFF00"><div align="center" class="STYLE20"><font face="华文楷体">广<span class="STYLE18"></span>辉新闻网</font> </div> <table width="54%" border="0" align="center"> <tr> <td><img src="images/t.jpg" alt="LOGO" width="159" height="64" align="middle"></td> </tr> </table> <div align="center"><a href="http://ent.qq.com/" target="_parent">腾讯娱乐</a></div> <form action="" method="post" name="form1" target="_blank"> <table width="99%" height="104" border="1" align="center"> <tr> <td colspan="4"><div align="center" class="STYLE19"><strong>管理员登录</strong></div></td> </tr> <tr> <td width="29%" ><span class="STYLE23">账号</span></td> <td width="71%" ><input type="text" name="adminid" <% if(request.getParameter("adminid")!=null){ %> value ='<%=request.getParameter("adminid")%>' <%}%> size="16"></td> </tr> <tr> <td ><span class="STYLE23">密码</span></td> <td ><input type="password" name="adminpwd" <% if(request.getParameter("adminpwd")!=null){ %> value ='<%=request.getParameter("adminpwd")%>' <%}%> size="16"></td> </tr> <tr> <td height="26" colspan="4"> <table width="95%" border="0"> <tr> <td width="26%"> </td> <td width="30%"><input type="submit" value="登录" name="loginButton"></td> <td width="41%"><input type="reset" name="Submit" value="取消"></td> <td width="3%"> </td> </tr> </table> </td> </tr> </table> </form> </td> <td height="20" colspan="2" align="left" valign="top" bgcolor="#CCFF00"> <div align="left"> <p class="STYLE24"><strong>版主简介</strong> </p> </div></td> </tr> <tr> <td width="166" height="245" align="left" valign="top" bgcolor="#CCFF00"><img src="images/12.gif" width="166" height="242"></td> <td width="583" align="left" valign="top" bgcolor="#CCFF00"><p class="STYLE18">姓名:堵广辉<br> 性别:男<br> 生日:1988-02-02<br> 身高:178cm <br> 祖籍:河南新乡<br> 兴趣:运动,音乐,篮球<br> 最爱 忠爱的球队:凯尔特人<br> 热爱的球星: 加内特<br> 最喜爱的电影: 国王的演讲<br> 最喜爱的演员: 李念 <br> 最喜爱的乐队: 子曰<br> 最欣赏的歌手: 朴树<br> </p> </td> </tr> <tr> <td rowspan="2" bgcolor="#CCFF00"> <form action="messagesave.jsp" method="POST" target="_blank"> <div align="center"><strong></strong> </div> <table width="199" border="1" bordercolor="#CCCCCC"> <tr bgcolor="#000000"> <td height="19" colspan="2" bgcolor="#CCFF00"> <div align="center"><strong><font face="华文楷体"><a href="messagelist.jsp" target="_blank" class="STYLE21">游客留言板</a></font></strong></div></td> </tr> <tr> <td width="56" height="18" bgcolor="#CCFF00"><span class="STYLE23">姓名 </span></td> <td width="127" bgcolor="#CCFF00"><input type="text" size="18" name="name"></td> </tr> <tr> <td height="18" colspan="2" bgcolor="#CCFF00"><span class="STYLE23">内容:</span></td> </tr> <tr> <td height="148" colspan="2" bgcolor="#CCCCCC"> <textarea name="note" rows="8" cols="25"></textarea> </td> </tr> </table> <table width="43%" border="0" align="center"> <tr> <td width="35%"> </td> <td width="9%"><input name="submit" type="submit" value="提交"></td> <td width="17%"><input name="reset" type="reset" value="取消"></td> <td width="39%"> </td> </tr> </table> </form></p> </td> <td height="20" colspan="2" align="left" valign="top" bgcolor="#CCFF00"> <p><font face="黑体"><a href="newslist.jsp" target="_blank" class="STYLE24">新闻列表</a></font></p></td> </tr> <tr> <td height="224" colspan="2" valign="top" bordercolor="#000000" bgcolor="#CCFF00"> <span class="STYLE19"> <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:database"); Statement smt =con.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); String getplacarddata = "" ; %> <% String getnewsdata = "" ; getnewsdata = "SELECT * FROM news WHERE published = true " ; ResultSet newsrs =smt.executeQuery(getnewsdata) ;%> <% while(newsrs.next()){ String newsid =newsrs.getString("newsid") ; String newstitle =newsrs.getString("newstitle") ; %> <a href="news.jsp?newsid=<%=newsid%>"><%=newstitle%></a> [<%=newsrs.getString("publishdate")%>]<br> <%}%> </span></td> </tr> </table> <p align="center"><font color="#FFFFFF"><span class="STYLE22"><strong>173632005@qq.com </strong>建议使用:1024 * 768 分辨率</span></font></p> </body> </html> <%@page contentType="text/html"%> <%@page pageEncoding="GB2312"%> <%@page import = "java.sql.*" %> <%@page import ="java.util.*,java.io.*"%> <%@page import ="javax.activation.*"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> <style type="text/css"> <!-- body,td,th { color: #FFFFFF; font-size: 24px; } body { background-color: #66FFFF; background-image: url(images/c4.jpg); } --> </style></head> <body link="#000000" vlink="#000000" alink="#000000"> <% Object obj=session.getAttribute("access") ; if (obj==null) session.setAttribute("access","n") ; if(session.getAttribute("access").equals("n")) {%> <p>非法进入或页面超时,请重新登录…</p> <p><a href="index.jsp">返回</a> </p> <%}else{%> <% String editType=request.getParameter("editType"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:database"); Statement smt =con.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); String editSQL = "" ; String msgid = request.getParameter("msgid") ; editSQL = "DELETE FROM message WHERE " + "msgid=" + msgid ; smt.execute(editSQL) ; out.println("留言已删除!") ;%> <%response.setHeader("Refresh","1;url=messagelist.jsp");%> <%}%> </body> </html>
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

穆雄雄

哎,貌似还没开张来着呢~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值