<%
String firstName = request.getParameter("T1");
try{
PrintWriter fileOut=new PrintWriter(new FileWriter//同一行("lovexing.txt",true));                             //同一行
fileOut.println(firstName);
fileOut.close();
}
catch(IOException ioExc){
}
%>这是简单例子,目的知道原理而已,但绝对不够的,
还有换行问题,自己搞定,这个不难
生成的文件名为lovexing.txt,经过测试,
这文件出现在c:\winnt\system32(我用的windows2k)

解决方案 »

  1.   

    你去查查关于特殊字符的资料吧,因为当你插入数据库的时候如果不对一些比如回车,空格之类的字符进行转换数据库是不认的,所以要转换才可以。http://expert.csdn.net/Expert/topic/1299/1299582.xml?temp=.8365595
      

  2.   

    to hydes:
    再送你一个换行问题的Bean,
    你引入它后,直接toBr方法就可以的了
    package test;public class ToBrBean{
        public static String toBr(String sStr){ 
        StringBuffer sTmp=new StringBuffer(); 
        int i=0;
    if(sStr==null||sStr.equals("")){
        return sStr;
        } 
         while (i<=sStr.length()-1){ 
         if(sStr.charAt(i)=='\n'){ 
         sTmp=sTmp.append("<br>"); 
        }
        else if(sStr.charAt(i)==' ') 
          sTmp=sTmp.append("&nbsp;"); 
                     else
         sTmp=sTmp.append(sStr.substring(i,i+1));
            i++;
        }
        sStr=sTmp.toString();
        return sStr;
        }
    }