ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws (Affordable web hosting)

ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception{ // Get the user’s login name and password. They should have already been// validated by the ActionForm. String email = ((LoginForm)form).getEmail( ); String password = ((LoginForm)form).getPassword( ); // Obtain the ServletContextServletContext context = getServlet().getServletContext( ); // Log which user is trying to enter the site context.log( “Login email: ” + email ); // Log in through the security serviceIStorefrontService serviceImpl = getStorefrontService( ); UserView userView = serviceImpl.authenticate(email, password); // Log the UserView for auditing purposes context.log( userView.toString( ) ); UserContainer existingContainer = null; HttpSession session = request.getSession(false); if ( session != null ){ existingContainer = getUserContainer(request); session.invalidate( ); }else{ existingContainer = new UserContainer( ); } // Create a new session for the user session = request.getSession(true); existingContainer.setUserView(userView); session.setAttribute(IConstants.USER_CONTAINER_KEY, existingContainer); return mapping.findForward(IConstants.SUCCESS_KEY); } } The LoginActionin Example 15-1 shows a very simple example of sending log messages to the container’s log file. It calls the log( ) method and passes a literal string message that will be written to the log. As was mentioned earlier, the name and location of the log are dependent on which web container is being used.
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

Leave a Reply