Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet could anyone please help with the code.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ankit gupta
could anyone please help with the code.
3 Answer(s)      2 years and 10 months ago
Posted in : JSP-Servlet


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


Advertisement
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
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
Advertisements
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
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
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
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> <
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
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
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 function computeGrade( ) { var hw, lab, midt, fin, avg; hw = parseFloat
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
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 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 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 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 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 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
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 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
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 help
please help  please send me the code of dynamic stack in java without using the built in functions
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
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
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
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
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
 

 

 

DMCA.com