Delete SecondServlet.java
This commit is contained in:
parent
a904f90ffc
commit
2db04e302f
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue