<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'tpl.jsp' starting page</title>
    
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="jQuery.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
  </head>
<body>
<form>
   <input type="text" id="txt3" style="width:60px;height:50px;font-size:30px;">
   <input type="text" id="txt4" style="width:60px;height:50px;font-size:30px;">
    <input type="submit" value="submit">
</form>
</body>
</html>

解决方案 »

  1.   

    给你ideinput标签取过名字,比如 <input type="text" name="txt3" .../> <form>标签中添加action属性 <form action="xxxServlet"> 然后服务器写一个servlet 在doPost()或者doGet()方法中定义一个文件流,FileWriter fw = new FileWriter(new FileOutputStream("文件路径"))
    得到页面传过来的数据,String txt3 = request.getParameter("txt3");
    使用文件流的写入方法写入文件就行了 fw.writeLine(txt3);
    大概思路就这样了。