Delete SecondServlet.java

This commit is contained in:
gupta-ashu01 2020-07-21 13:00:09 +05:30 committed by GitHub
parent 8b16479fd9
commit 7ff9bc6ac8
1 changed files with 0 additions and 31 deletions

View File

@ -1,31 +0,0 @@
package httpsessionexample;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class SecondServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(true);
String name = (String) session.getAttribute("uname");
out.print("Hi " + name);
out.print("</br> ");
out.print("Session Id : " + session.getId());
out.print("</br> ");
out.close();
} catch (Exception e) {
System.out.println(e);
}
}
}