jsp页面太慢了
怎么把jsp页面转成静态的?
首页对那些新闻类的网站怎么搞
首页面跟终端页面
我在网上看到这个程序,但不知道怎么去用它,谁知道就说说吧.谢谢了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());
       }
    }
}

解决方案 »

  1.   

    private static void a(String s)中
          
    File file = new File(s);
            if(!file.exists())
                file.mkdirs();  //创建目录以及该目录的所有父目录
    s为"d:/root/sub",如果没有root目录,mkdirs()就会自动创建它。a(s1);//创建目录s1
    s2应该是文件名,如file.txt
    s1+s2应该是d:/root/sub/file.txt,也就是该文件的路径
    FileOutputStream fileoutputstream = new FileOutputStream("s1+s2"); 
    byte abyte0[] = s.getBytes();//提取字节数组对等体
    fileoutputstream.write(abyte0);//把s中的内容写到对象文件中
      

  2.   

    这个程序的作用就是把字符串s 写入到s1目录下的s2文件名中
      

  3.   

    import java.io.*;
    import java.net.*;
    /**
     * @author Administrator
     *
     * TODO To change the template for this generated type comment go to
     * Window - Preferences - Java - Code Style - Code Templates
     */
    public class Tohtml {
    public void jsp_to_html(String jsp_url,String html_filepath)//第一个参数是要转换文件的url第二个参数是要转换成的文件名和绝对路径
    throws Exception
    {
     URL stdURL = null;
     BufferedReader stdIn = null;
     PrintWriter stdOut = null;
     try {
       stdURL = new URL(jsp_url);
     }
     catch (MalformedURLException e) {
       throw e;
     }  try {
       stdIn = new BufferedReader(new InputStreamReader(stdURL.openStream()));
       stdOut = new PrintWriter(new BufferedWriter(new FileWriter(html_filepath)));
     }
     catch (IOException e) {
     }  /***把URL指定的页面以流的形式读出,写成指定的文件***/
     try {
       String strHtml = "";
       while((strHtml = stdIn.readLine())!=null) {
         stdOut.println(strHtml);
       }
     }
     catch (IOException e) {
       throw e;
     }
     finally {
       try {
         if(stdIn != null)
           stdIn.close();
         if(stdOut != null)
           stdOut.close();
       }
       catch (Exception e) {
         System.out.println(e);
       }
     } }