articlesmodifysave.jsp

来自「一个很有用的电子刊物发布系统」· JSP 代码 · 共 63 行

JSP
63
字号
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*,com.am.*" %>
<HTML>
<HEAD>
	<title>刊物文章管理系统</title>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<BODY>
<jsp:useBean id="article" scope="page" class="com.am.article"/>
<jsp:useBean id="dbconn" scope="application" class="com.am.OpenDB"/>
<%
    String strTime;
    java.text.SimpleDateFormat dateFormatterfile = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
    strTime=dateFormatterfile.format(new java.util.Date());
    String fileName="";
    FileUpload myUpload=new FileUpload();
    myUpload.initialize(request,response);
    if(myUpload.getFormFields("isReUpload").equals("1"))
    {
        myUpload.setMax_size(10240000);
		myUpload.setFilePath("E:\\am\\uploadArticles\\");
        fileName=myUpload.getFileName();
		fileName=strTime + "-" +myUpload.getFormFields("txtissuer") + fileName.substring(fileName.lastIndexOf("."),fileName.length());
        myUpload.saveFile(fileName);
        if(myUpload.getErrNum()!=0 )
        {
            out.println(myUpload.getErrDesc() );
        }
    }

    article.setConnection(dbconn.getConnection());
    article.ID=Long.parseLong(myUpload.getFormFields("txtID"));
    article.init();
    if(myUpload.getFormFields("isReUpload").equals("1"))
    {
        article.fileName =fileName;
    }
    java.text.SimpleDateFormat dateFormatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    article.createDatetime =dateFormatter.format(new java.util.Date());
    article.title =new String(myUpload.getFormFields("txttitle").getBytes("ISO-8859-1"),"gb2312");
    article.summary =new String(myUpload.getFormFields("txtsummary").getBytes("ISO-8859-1"),"gb2312");
    article.author =new String(myUpload.getFormFields("txtauthor").getBytes("ISO-8859-1"),"gb2312");
	
	article.workgroup=Long.parseLong(myUpload.getFormFields("txtworkgroup"));	
    article.issuer =Long.parseLong(myUpload.getFormFields("txtissuer"));
    article.tag =0;
    article.update();
	if(article.getErrNum()==0)
	{
		out.println("<center><font color=blue size=5>文章修改成功!</font></center>");
		out.println("<center><input type=button name=gofirst value=回首页 onclick=javascript:window.location='articlesList.jsp' ></center>");

	}
	else
	{
		out.println("<center><font color=red size=5>文章修改,请稍后重试!</font></center>");
    	out.println("<center><input type=button name=goback value=返回 onclick=javascript:window.history.go(-1) ></center>");
	}

 %>
</BODY>
</HTML>

⌨️ 快捷键说明

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