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

📄 htmlnews.java

📁 jsp开发常用信息管理系统适合初学者学习 新闻管理
💻 JAVA
字号:
package ch06;

import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;

public class htmlNews {

    public htmlNews() throws Exception {
        config = new config();
        dbConn = new dbConn();
        handle = new handle();
        managerNews = new managerNews();
        systemURL = config.systemURL + "/" + config.systemFolder + "/";
        tb_news_type_module = config.tb_news_type_module;
        tb_news_module = config.tb_news_module;
    }

    public int CreateAll(HttpServletRequest httpservletrequest, String s)
            throws Exception {
        String s1 = "";
        int j = 0;
        String s7 = handle.getString(httpservletrequest, "means");
        try {
            if (s7.equals("recent"))
                s1 = "SELECT * FROM " + s
                        + " WHERE publish_html=0 ORDER BY id DESC";
            else if (s7.equals("all"))
                s1 = "SELECT * FROM " + s + " ORDER BY id DESC";
            for (ResultSet resultset = dbConn.ExeQuery(s1); resultset.next();) {
                int i = resultset.getInt("id");
                String s8 = managerNews.getModule(resultset.getInt("type_id"),
                        tb_news_type_module, tb_news_module);
                if (s8 == null)
                    throw new Exception(
                            "\u8BF7\u5148\u628A\u680F\u76EE\u5173\u8054\u5230\u6A21\u7248");
                String s4 = resultset.getString("date_time");
                String s5 = handle.Convert2Path(i, s4);
                String s6 = config.htmlFolder + "/" + handle.Split("/", s5)[0];
                s5 = config.htmlFolder + "/" + s5;
                String s3 = handle.ReadUrl(config.systemURL + "/"
                        + config.systemFolder + "/module/" + s8
                        + "/detail_news.jsp?Nid=" + i);
                handle.MkDir(httpservletrequest, s6);
                handle.WriteFile(httpservletrequest, s5, s3);
                String s2 = "UPDATE " + s + " SET publish_html=1 WHERE id=" + i;
                dbConn.ExeUpdate(s2);
                j++;
            }

            dbConn.CloseConn();
        } catch (SQLException sqlexception) {
            System.err.println("aq.executeQuery:" + sqlexception.getMessage());
        }
        return j;
    }

    public void CreateOne(HttpServletRequest httpservletrequest, String s,
            String s1) throws Exception {
        String s2 = handle.ReadUrl(s1);
        handle.WriteFile(httpservletrequest, s, s2);
    }

    handle handle;

    dbConn dbConn;

    managerNews managerNews;

    config config;

    private String systemURL;

    private String tb_news_type_module;

    private String tb_news_module;
}

⌨️ 快捷键说明

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