943,778 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 1465
  • JSP RSS
Aug 26th, 2008
0

problem with password validation

Expand Post »
hello,
I just noticed a problem in my code.
hope you'll would help me.
normally we have a login page where the userid and password is validated from database .now the problem what i am facing is

JSP Syntax (Toggle Plain Text)
  1. while(rs.next())
  2. {
  3. if((rs.getString("m_emp_no").equals(user)) && (rs.getString("m_password").equals(pwd)) )
  4. {
  5. " " direct to some page
  6. }
  7. else
  8. {
  9. <script language="javascript">
  10. alert("Sorry!Wrong User ID or Password entered.Try Again");
  11. document.f1.action="loginpage"
  12. document.f1.submit();
  13. }
  14. }

now the code is working fine to log in to the main page but when i type any user id or password in the text box then it doesnt direct me to the alert box else it just shows me a blank page.for example if my password is "welcome" in database and i type "Welcome" which is in caps then it prompts me the alert box but if it type "hello123" then it doesnt prompt me the alert box.i really dont understand what is the problem.i even tried with this code
JSP Syntax (Toggle Plain Text)
  1. if(rs.next()==true)
  2. {
  3. }
  4. else if(rs.next()==false)
  5. {
  6. javascript
  7. }
here it directs me to the alert box if i put any password wrong, but here the problem is if the password column in database is in caps such as "Welcome" and in the page if i insert "welcome" in lower case still it accepts and direct me to the main page which shouldnt happen.so pls anyone could help me out of this .if the question is not clear pls ask me to send it again.
thanks in advance.
Last edited by peter_budo; Aug 26th, 2008 at 7:46 am. Reason: Keep It Organized - please use [code] tags
Similar Threads
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
shijunair is offline Offline
50 posts
since Jul 2008
Aug 27th, 2008
-1

Re: problem with password validation

Is there no one to help me out of this.I was expecting some help from you people.Anyways i am still waiting for the solution .if any one could help me out, it would be a great favour.
thanks
Reputation Points: 8
Solved Threads: 0
Junior Poster in Training
shijunair is offline Offline
50 posts
since Jul 2008
Aug 27th, 2008
0

Re: problem with password validation

JSP Syntax (Toggle Plain Text)
  1. while(rs.next())
  2. {
  3. if((rs.getString("m_emp_no").equals(user)) && (rs.getString("m_password").equals(pwd)) )
  4. {
  5. " " direct to some page
  6. }
  7. else
  8. {
  9. <script language="javascript">
  10. alert("Sorry!Wrong User ID or Password entered.Try Again");
  11. document.f1.action="loginpage"
  12. document.f1.submit();
  13. }
  14. }
I notice the following problems :-
  • First no indentations
  • Next I do not know where does this code go, is it inside a servlet or inside a JSP page, either way you should get an error cause you are directly mixing html with java code without appropriate delimiters
  • And the code you are using to redirect you have completely skipped it from what can be seen, which is from your description appears to be where the problem lies.
Last edited by stephen84s; Aug 27th, 2008 at 6:31 am.
Featured Poster
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
stephen84s is offline Offline
1,316 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: Hibernate tutorial
Next Thread in JSP Forum Timeline: LoginScript using JSP-Session





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC