Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Urgent Help

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Urgent Help

    Hii I have an application with user login.When the user logs in, I need to have a change password option.How can I implement this.I am using struts, spring and hibernate.I think I need to check the oldpassword entered by user with the database and also check the new password and confirm password are equal or not and update the database iwth the new password value.This is my idea.Help me in implementing this.Any help is appreciated.

    Thanks.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Urgent Help

    What is this for? What have you done so far?

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Urgent Help

    I created the Action class,changepassword.jsp...I am fetching the password from database...
    How can I fetch the values user entered in the changepassword.jsp to my ACtion class.In ACtion I am checking the oldpassword with the one present in databse.And then, I am checking if the newpassword and confirmpassword are equal and I need to save the new password.

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Urgent Help

    You can use the HttpServletRequest object.

    final String oldPassword = reguest.getParameter("oldpassword");

    And then just compare these using the equals method.

    // Json

  5. #5
    Junior Member
    Join Date
    Nov 2009
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Urgent Help

    Hello, further, after comparing the user typed details......how can I save the newpassword given by user to the database.Plz provide the code.

    Thank You

  6. #6
    Junior Member
    Join Date
    Nov 2009
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Urgent Help

    Helloooo...plz help me further....

  7. #7
    Member Truffy's Avatar
    Join Date
    May 2009
    Location
    Philippines
    Posts
    93
    Thanks
    2
    Thanked 9 Times in 7 Posts

    Default Re: Urgent Help

    String oldpw = request.getParameter("oldpw");
                String newpw;
     
                // Did the user enter same value?
                oldpw = request.getParameter("oldpw");
                // If not, use the drop-down list value
                if ( (oldpw != newpw)  ) {
               // retrieve the "newpw" attribute from the session-scope
                HttpSession session = request.getSession();
               Anymodel model = (PwordChange)session.getAttribute("newpw");
                newpwitem item = model.newpw(oldpw, newpw);
     
                // Store the item on the request-scope
                request.setAttribute("newpwitem ", item);
                return mapping.findForward("success");
                }

    hope it helps.

    Cheers,
    Truffy
    Last edited by Truffy; December 1st, 2009 at 01:42 AM. Reason: not in java format

  8. #8
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Urgent Help

    Have a look at this to find out how Java and JDBC can help you set up a database connection.

    JDK 6 Java Database Connectivity (JDBC)-related APIs & Developer Guides -- from Sun Microsystems

    // Json

Similar Threads

  1. Urgent Doubts
    By shilpareddy553 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 27th, 2010, 02:26 AM
  2. JSP E-BOOK URGENT PLEASE
    By YUSUFOZTURK in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: December 1st, 2009, 06:58 PM
  3. Urgent code needed
    By subhvi in forum AWT / Java Swing
    Replies: 4
    Last Post: August 27th, 2009, 12:55 AM
  4. Replies: 1
    Last Post: May 4th, 2009, 06:30 AM