<%@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>
新闻发布项目——后台JSP界面adminManage/modifyNews.jsp
最新推荐文章于 2024-02-21 14:25:08 发布