欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

jsp生成html--writehtml

程序员文章站 2022-05-28 20:46:40
writehtml.javapackage ball.news;import java.io.*;public class writehtml{    pub...


writehtml.java

package ball.news;

import java.io.*;

public class writehtml
{

    public writehtml()
    {
    }

    public static void save(string s, string s1, string s2)
       
    {
        try
        {
            a(s1);
            fileoutputstream fileoutputstream = new fileoutputstream(s1 + s2);
            byte abyte0[] = s.getbytes();
            fileoutputstream.write(abyte0);
            fileoutputstream.close();
        }
        catch(ioexception e)
        {
         system.out.println("write html error"+e.getmessage());
        }
    }

    private static void a(string s)
    {
       try
       {
        file file = new file(s);
        if(!file.exists())
            file.mkdirs();
       }
       catch (exception e)
       {
        system.out.println("mkdirs error!"+e.getmessage());
       }
    }
}