could anyone please help with the code.

could anyone please help with the code.

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html"); PrintWriter out=response.getWriter(); HttpSession session=request.getSession(); session.setAttribute("lErrorMsg",null); String target="jsp/hrms_default.jsp"; String action=request.getParameter("action_submit"); //String actionchngpswd=request.getParameter("actionchngpswd"); //String username=request.getParameter("username"); System.out.println("user_name");

/* If the details are submitted with the user name and other fields */
    System.out.println(action);
    if(action.equalsIgnoreCase("hrms_user_login_submit"))
    {
        /* Requesting all the details from the jsp page */

        System.out.println("inside action_submit");
        String userId=request.getParameter("user_id");
        String userName=request.getParameter("user_name");
        String password=request.getParameter("user_password");
        System.out.println(userId);

        /* Setting the details to the bean class */

        userLogin_bean obj=new userLogin_bean();
        obj.setUser_Id(userId);
        obj.setPassword(password);
        obj.setUserName(userName);

        userLogin_model modelObj=new userLogin_model();
        System.out.println("model obj created");
        try 
        {
            boolean valid=modelObj.checkLogin(obj);
            if(valid==true)
            {
                System.out.println("user valid");
                 target="jsp/hrms_default.jsp";

            }

            else
            {
                System.out.println("invalid user");
            //  String lErrorMsg="user does not exist";
                //session.setAttribute("lErrorMsg",lErrorMsg);
                target="jsp/Hrms_user_login.jsp";


            }
            //RequestDispatcher requestDispatcher=request.getRequestDispatcher(target);
            //requestDispatcher.forward(request, response);
        }
        catch (SQLException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    RequestDispatcher requestDispatcher=request.getRequestDispatcher(target);
    requestDispatcher.forward(request, response);

}

} could anyone please check the code. If i enter the correct username and password it redirects me to the correct page but if I enter the incorrect username and password then it redirects me to different page

View Answers

January 29, 2012 at 5:05 PM

You may debug it in tomcat when the request comes to Servlet. Check for the exception also.

------------------------------------
Chandraprakash Sarathe
http://javaved.blogspot.com/


January 29, 2012 at 5:18 PM

the problem is if i enter username and password correctly then it works fine and if i enter it incorrectly once it again redirects me correctly but after entering the details again after failed attempt then it does not redirect correctly.


January 29, 2012 at 5:18 PM

the problem is if i enter username and password correctly then it works fine and if i enter it incorrectly once it again redirects me correctly but after entering the details again after failed attempt then it does not redirect correctly.









Related Tutorials/Questions & Answers:
could anyone please help with the code.
could anyone please help with the code.  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException...(request, response); } } could anyone please check the code. If i enter
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone  The Airport Valet Parking Company (AVP) is a company which provides a convenient medium cost parking solution to users of a local airport. Key
Advertisements
Could anyone point me towards some good Spring tutorials, Please?
Could anyone point me towards some good Spring tutorials, Please?  Hi, I would like to learn Spring Framework and so, if you can tell me where I can find some good Spring tutorials, that would be very helpful. Thanks in advance
Please help with this code
Please help with this code  I need some help getting the Search method below to work with the menu, and I also cannot figure out how to get my bubble sort to work. I've spent a long time on this and think my brain is just fried
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   The Task Write a class whose objects will represent students. The class should have three fields for representing a studentâ??s
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   Write a class whose objects will represent students.The class should have three fields for representing a studentââ?¬â?¢s name, this studentââ?¬â?¢s
ajax code please help to solve this........
ajax code please help to solve this.  in this i am trying to get data... null; } please help me when i am running this it show an error...;<a href="help.jsp">help instruction</a></li> <
Not sure whats wrong with my code HELP PLEASE?!?!
Not sure whats wrong with my code HELP PLEASE?!?!  I cant figure out what I am doing wrong in my code can anyone help me out??? Grades ADS_TO_REPLACE_1 function computeGrade( ) { var hw, lab, midt, fin, avg; hw
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
need source code fir automatic timesheet filling. can anyone peass help?
need source code fir automatic timesheet filling. can anyone peass help?  Hi friends, I wants to develop a software that should automatically fills the time sheet using the login and log out entries. Can anyone please help me
please help me to give code - Java Beginners
please help me to give code  Write a function, sliding(word, num)that behaves as follows. It should print out each slice of the original word having length num, aligned vertically as shown below. A call to sliding(examples, 4
please help me to give code - Java Beginners
please help me to give code  Write a function with a signature cheerlead(word) that prints a typical cheer as follows. The word robot: Gimme an R Gimme an O Gimme a B Gimme an O Gimme a T What did you give me? ROBOT
Please help me fix this code - MobileApplications
Please help me fix this code   Please help me in this area of code... in the background of the forms in this code i want to sum all expenses amount... expenses)", "Please fill all required field \n \n * This signify required field
please help me to give code - Java Beginners
please help me to give code  Write a program that prints an n-level stair case made of text. The user should choose the text character and the number of stairs in the stair case * ** *** ****   Hi friend
please help me to give code - Java Beginners
please help me to give code  Write a program that uses loops to generate an n x n times table. The program should get n from the user. As a model here is a 4 x4 version: | 1 2 3 4
please help me to give code - Java Beginners
please help me to give code  Write a program that reads a file named famous.txt and prints out the line with the longest length. In the case of a tie, you may print out only one of them. For example in the file: Alan Turing
A few questions related to developing a blog....can anyone please help me out??
A few questions related to developing a blog....can anyone please help me out??  I am trying to develop a project which is almost like a blog using jsp.I have a few questions.... Can anyone tell me if we can insert images
Please help me to modify my java code from php code
]; } } I tried like this (see below JSP code) ... but this is not giving me the exact result as the above PHP code is giving. So please help me to convert...Modify Java code from PHP Code  i want to covert this php code int
Please help me to modify my java code from php code
Please help me to modify my java code from php code  i want to covert...) ... but this is not giving me the exact result as the above PHP code is giving. So please... same, as they alter it before. Please help me on this topic "how to order rows
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  1) Copy one file content to other? 2) Count the number of words in a file
Please help me to write a code for add contacts to groups in a website?
Please help me to write a code for add contacts to groups in a website?   Iam developing a site. In that site I need to write code for Groups... send a code for this? Please make it fast
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my code is supposed to ask for an input file and then (ex: input.txt), read... in the file. Also it should be displayed on the screen. However my code doesn't display
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  Q 1) In a class first day 25 students are joined. After two days that total students will increased to 60. We can develop a program by using ArrayList concept
please help
please help  please send me the code of dynamic stack in java without using the built in functions
this is my javascript code and i am not understanding the mistake in this,please help me?
this is my javascript code and i am not understanding the mistake in this,please help me?  <html> <h2>Form Validation</h2>...; if((nn1.value==null)||(nn1.value=="")){ alert("Please Enter
could someone help in this ........
could someone help in this ........  dear Sir/Mrs I'll be thankful for helping me on this ....... write a program that reads 10 numbers. find the largest number and count the occurrence of the largest number from a declared
please help//
please help//  Number square cube 1 1 1 3 9 27 5 25 125 7 49 343 9 81 729 total 165 1225 â?? this is the ouput..;;; i
please help//
please help//  Number square cube 1 1 1 3 9 27 5 25 125 7 49 343 9 81 729 total 165 1225 â?? this is the ouput..;;; i
please help//
please help//  Number square cube 1 1 1 3 9 27 5 25 125 7 49 343 9 81 729 total 165 1225 â?? this is the ouput..;;; i
help please?
help please?  Define a class named Circle with the following properties: â?¢ An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both data fields
help please?
help please?  Define a class named Circle with the following properties: List item â?¢ An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help please?
help please?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help please?
help please?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help please?
help please?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
Please Help
Please Help  How do I create an attribute that represents the following: A grayscale 'color' value, that is, an integer between 0 and 255 inclusive, where 0 corresponds to the darkest black and 255 to the brightest white
Please Help
Please Help  How do I create an attribute that represents the following: A grayscale â??colorâ?? value, that is, an integer between 0 and 255 inclusive, where 0 corresponds to the darkest black and 255 to the brightest white
help please
file.. Or atleast help me with code here.. I tried checking session alive...help please  hi i am done with register application using jsps servlets htmls. But i couldnt imp one thing that.. Wen u login to ur account browser
Please help
Please help  Problem: Write a program that does addition, subtraction, multiplication and division operation on real numbers. The operation started with a user entered 2 numbers and click one of the operation buttons
java please please help
java please please help  Dear Friends plz help me to complete this program import java.util.*; public class StringDemo { static...[] to HashMap so that i can seperate key and value using Map.Entry.Please help me!  
help please?
help please?  Define a class named Circle with the following properties: ? An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both data fields
Please help
Please help  Problem: Write a program that does addition, subtraction, multiplication and division operation on real numbers. The operation started with a user entered 2 numbers and click one of the operation buttons
please help
please help  public class AllContact extends javax.swing.JFrame { /** Creates new form AllContact */ public AllContact() { initComponents(); try{ Connection1 con =new Connection1(); Connection conobj
urgent...pleAse help me.....please!
urgent...pleAse help me.....please!  please help me urgent! how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
could any one help me?
could any one help me?  I'm a student in the faculty of computer and information science we will make graduation project "taxi dispatcher" we need to use mobile "x6 nokia" in car and send the coordinate of car through gps which
Could someone Possibly help me with this
Could someone Possibly help me with this   think of a number and allow the user to guess it import java.util.*; public class ThinkNumber...(); } System.out.println("Correct!!!!!!!"); } } But when the code is run I do
please help me.
please help me.  Please send me a code of template in opencms and its procedure.so i can implement the code. Thanks trinath
please help me
please help me  Dear sir, I have a problem. How to write JSP coding... before. This name list should get from the database. Please help me. By the way, I'm using access database and jsp code. Thank you
please help me.
please help me.  How to read a properties file in java with a suitable example. Please send me. Thanks Trinath   Please visit the following link: Java read properties file
why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...
why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...   public class d55 { int squares = 81; public static void main(String

Ads