如何在HTML页面上设置三个文本字段,并使用Servlet将数据输入存储在服务器上的文本文件中?
答案 0 :(得分:0)
<input type="text" name="firstname" id="firstname" />
<input type="text" name="middlename" id="middlename" />
<input type="text" name="lastname" id="lastname" />
in servlet
String firstname=request.getParameter("firstname");
String middlename=request.getParameter("middlename");
String lastname=request.getParameter("lastname");
答案 1 :(得分:0)
使用以下内容将组合的String附加到文件中:
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(“FileName”,true))); out.println(createFullNameString(firstName,middleName,lastName)); out.close();