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