newsmodify.jsp
上传用户:junmaots
上传日期:2022-07-09
资源大小:2450k
文件大小:3k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@page contentType="text/html; charset=GBK" language="java" %>
  2. <%@page import="com.mycompany.news.service.NewsService"%>
  3. <%@page import="com.mycompany.news.dto.*"%>
  4. <%@page import="java.text.SimpleDateFormat" %>
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  6. <html>
  7.  <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=gbk">
  9.    <title>新增新闻信息</title>
  10.    <script language="javascript1.2" src="../js/editor.js" type="text/javascript"></script>
  11.    <script language="Javascript1.2">browserControl()</script>
  12.    <link href="../css/common.css" rel="stylesheet" type="text/css">
  13.  </head>
  14.  
  15. <%
  16. Long id=Long.valueOf(request.getParameter("id"));
  17. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  18. NewsService service = new NewsService();
  19. News news = service.getByID(id.longValue());
  20. java.util.List attachments = service.getAttachments(id.longValue());
  21. %>
  22. <body leftmargin="40">
  23. <form name="form1" action='<%=request.getContextPath()%>/servlet/ModifyNews' method="post" enctype="multipart/form-data" >
  24. <input type="hidden" name='columnId' value="<%=news.getColumnId()%>">
  25. <input type="hidden" name='newsId' value="<%=news.getNewsId()%>">
  26. <table  align="left"  border=0 width="90%">
  27. <tr>
  28.  <td colspan="4" align="center"><b>编辑新闻</b></td>
  29. </tr>
  30. <tr>
  31.  <td width="90" align='right'>新闻标题</td>
  32.  <td width="350"><input type="text" name ='subject' style="width:100%" value='<%=news.getSubject()%>'> </td>
  33.   <td width="150" align='right'>新闻显示时间</td>
  34.  <td><input name='showTime' value="<%=news.getShowTime()!=null?sdf.format(news.getShowTime()):""%>"></td>
  35. </tr>
  36. <tr>
  37.  <td colspan='4' align="center">
  38.          <textarea name="content" style="width:100%; height:80"><%=news.getContent()%></textarea>
  39.  </td>
  40.  </tr>
  41. <%for(int i=0;i<attachments.size();i++){
  42. NewsAttachment attachment = (NewsAttachment )attachments.get(i);
  43. if(service.isImage(attachment)){
  44. %>
  45. <tr>
  46.  <td align="right"><%=attachment.getAttachmentName()%>
  47.  <a href="<%=request.getContextPath()%>/servlet/download?id=<%=attachment.getAttachmentId()%>">
  48.  <image border="0" width="200" height="100" src="<%=request.getContextPath()%>/servlet/download?id=<%=attachment.getAttachmentId()%>">
  49.  </a>
  50.  </td>
  51.  
  52. </tr>
  53. <%
  54. }
  55. %>
  56. <%}%>
  57. <%for(int i=0;i<attachments.size();i++){
  58. NewsAttachment attachment = (NewsAttachment )attachments.get(i);
  59. if(!service.isImage(attachment)){
  60. %>
  61. <tr>
  62.  <td align="right"><a href="<%=request.getContextPath()%>/servlet/download?id=<%=attachment.getAttachmentId()%>">附件:<%=attachment.getAttachmentName()%></a></td>
  63. </tr>
  64. <%
  65. }
  66. %>
  67. <%}%>
  68. <tr>
  69.  <td>发布人</td>
  70.  <td><input name="author" value='<%=news.getAuthor()%>'></td>
  71. <td>是否更新附件</td>
  72.  <td><input type="radio" name="updateattr" value="y">是<input type="radio" name="updateattr" value="n" checked>否</td> 
  73. </tr>
  74. <tr>
  75.  <td>新附件1</td>
  76.  <td><input type='file' name='file'></td>
  77.  <td>新附件2</td>
  78.  <td><input type='file' name='file'></td>
  79. </tr>
  80. <tr>
  81. <td colspan=4 align='center'><input type='submit' value='提交'></td>
  82.  
  83. </tr>
  84. </table>
  85. </form>
  86. </body>
  87. </html> 
  88. <script language="javascript1.2">newConfig('content')</script>