Delete SecondServlet.java

This commit is contained in:
gupta-ashu01 2020-08-08 15:10:35 +05:30 committed by GitHub
parent a904f90ffc
commit 2db04e302f
1 changed files with 0 additions and 31 deletions

View File

@ -1,31 +0,0 @@
package com.baeldung.httpsession;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
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 {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(true);
String name = (String) session.getAttribute("uname");
out.println("Hi " + name + " Your Session Id is : " + session.getId());
out.close();
} catch (Exception e) {
System.out.println(e);
}
}
}