Results 1 to 3 of 3

Thread: Handling In JSP:

  1. #1
    CarterBaker is offline Senior Member
    Join Date
    Dec 2009
    Posts
    210
    Rep Power
    3

    Default Handling In JSP:

    Session Handling In JSP:

  2. #2
    HowardAdams is offline Senior Member
    Join Date
    Dec 2009
    Posts
    214
    Rep Power
    3

    Default

    Session management can be getting by using the following things:


    • Cookies

    • URL rewriting

    • Hidden form fields
    Last edited by nitesh14; 02-06-2010 at 03:35 PM.

  3. #3
    BarnesHarris is offline Senior Member
    Join Date
    Dec 2009
    Posts
    213
    Rep Power
    3

    Default

    Follow the given code below which is resolves your problem:

    public class ProcessLoginAction
    extends LoginAction
    {
    public ActionForward doAction(ActionMapping mapping,
    ActionForm form,
    BreadCrumbTrail breadCrumbTrail,
    EventLog eventLog, User user,
    HttpServletRequest request,
    HttpServletResponse response)
    {
    ActionForward forward=null;

    UserManager userManager=Context.getContext().getUserManager();

    String username=
    ((String) request.getParameter(Parameters.USERNAME));
    String password=
    ((String) request.getParameter(Parameters.PASSWORD));
    String redirect=
    ((String) request.getParameter(Parameters.REFERRER));

    if ( (username==null) || (username.equals(""))
    ||(password==null) || (password.equals(""))
    )
    {
    String userMessage =
    "Please enter both a username and password.";
    request.setAttribute(Attributes.USER_MESSAGE,userM essage);
    forward = mapping.findForward(ActionForwardConstants.LOGIN_M AIN);
    } else
    {
    try
    {
    User registeredUser=
    userManager.authorizeUser(username,password);
    // get session
    HttpSession session = request.getSession(true);

    session.setAttribute(Attributes.USER,registeredUse r);
    if ( redirect==null || redirect.equals("") )
    {
    redirect=Links.linkToHomeMain();
    }
    forward=new ActionForward(redirect);
    forward.setRedirect(true);
    } catch ( AuthorizationException ae )
    {
    String userMessage =
    "Invalid username/password combination. Please try again.";
    request.setAttribute(Attributes.USER_MESSAGE,userM essage);
    forward =
    mapping.findForward(ActionForwardConstants.LOGIN_M AIN);
    }
    }
    return forward;
    } // doAction
    Last edited by nitesh14; 02-06-2010 at 03:35 PM.

Similar Threads

  1. Handling Winamp as browsing
    By WilsonMartin in forum General Internet Terms
    Replies: 4
    Last Post: 02-22-2010, 02:59 PM
  2. Handling with PC Crashes
    By PerryCollins in forum Operating System
    Replies: 0
    Last Post: 02-12-2010, 01:19 PM
  3. udev handling each of the devices
    By brendin44 in forum Everything Else
    Replies: 0
    Last Post: 12-19-2008, 06:06 AM
  4. Handling boot failures and MBR overwriting
    By Macavi6987 in forum Applications
    Replies: 0
    Last Post: 11-22-2008, 01:02 PM
  5. Handling comments
    By prtec.teck in forum General Internet Terms
    Replies: 0
    Last Post: 10-15-2008, 08:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48