GetSession
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class GetSession extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession hs=request.getSession();
String str1=(String)hs.getAttribute("a");
String str2=(String)hs.getAttribute("b");
out.println(str1+str2);
}
}
import javax.servlet.*;
import javax.servlet.http.*;
public class GetSession extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession hs=request.getSession();
String str1=(String)hs.getAttribute("a");
String str2=(String)hs.getAttribute("b");
out.println(str1+str2);
}
}
Comments
Post a Comment