package cs320.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/Members") public class Members extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { // check if a user has logged in or not if( request.getSession().getAttribute( "user" ) == null ) { response.sendRedirect( "Login" ); return; } // if the user is logged in, display the members-only content response.setContentType( "text/html" ); PrintWriter out = response.getWriter(); out.println( "" ); out.println( "Member-Only Area" ); out.println( "" ); out.println( "

Member-Only Area!

" ); out.println( "Logout" ); out.println( "" ); } protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { doGet( request, response ); } }