The server is Glassfish
Error 404 Page not found or you are not connected to a network
Web page Code
<html>
<head>
<title>Wow</title>
</head>
<body>
<form name ="wow" method="post" action="ThatWas">
Name : <input type="text" name="name">
<input type="submit" value="That">
</form>
</body>
</html>
Code for Servlet is
public class ThatWas extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
String name = request.getParameter("name");
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ThatWas</title>");
out.println("</head>");
out.println("<body>");
out.println(" That was good "+ name + request.getContextPath());
out.println("</body>");
out.println("</html>");
}
}
When servlet is run
Result is
That was good + FilePath
When Web page button is clicked
Result is
You are not connected to a network
the result should be That was good + name + File Path