1import java.io.*;
2import javax.servlet.*;
3import javax.servlet.http.*;
4
5public class First extends HttpServlet {
6
7 protected void doPost(HttpServletRequest request, HttpServletResponse response)
8 throws ServletException, IOException {
9 response.setContentType("text/html;charset=UTF-8");
10 PrintWriter out = response.getWriter();
11
12 //getting value submitted in form from HTML file
13 String user = request.getParameter("user");
14
15 //creating a new hidden form field
16 out.println("<form action='Second'>");
17 out.println("<input type='hidden' name='user' value='"+user+"'>");
18 out.println("<input type='submit' value='submit' >");
19 out.println("</form>");
20 }
21}
22