<%@ page contentType="text/html; charset=gb2312" language="java" import="java.io.*" errorPage=""%> <HTML> <BODY> <% String strp = request.getParameter("p");//得到请求的参数 String strp1 = request.getParameter("p1");//得到请求的参数 String strp2 = request.getParameter("p2");//得到请求的参数 String strp3 = request.getParameter("p3");//得到请求的参数 if (strp != null && strp.length() > 0) { //把html表单提交保存到c:\aa.txt文件 FileWriter fw = new FileWriter("d:\\aa.txt", true); fw.write(strp + "\t\t\t\t\t"+strp1 + "\t\t\t\t\t"+strp2 + "\t\t\t\t\t"+strp3 + "\t\t\t\t\t" + "\r\n"); //+new java.util.Date().toLocaleString()创建时间记录 fw.flush(); fw.close(); out.write("<font color=\"red\">" + strp + " </font>已经写入d盘的aa.txt"); } %> <form name="form1" method="post" action="<%=request.getContextPath()%>/aa.jsp"> <label> 图书编号: <input type="text" name="p"><br> 图书名称: <input type="text" name="p1"> <br> 作    者: <input type="text" name="p2"><br> 价    格: <input type="text" name="p3"> <br> <input type="submit"name="Submit" value="提交"> </label> </form> </BODY> </HTML>
|
|
来自: weixiaofeng01 > 《技术方法》