Results 1 to 2 of 2
Thread: jsp authentication
- 08-13-2009, 03:51 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 16
- Rep Power
- 0
jsp authentication
Hi, I have login JSP:
and the output in browser, if I enter username tom is NO. Why is this error? I think, that the if statement is right. Thanks a lot for Your ideas. :)XML Code:<% String username=request.getParameter("username"); if (username=="tom") { out.println("YES"); } else { out.println("NO"); } %>
-
Avoid comparing Strings with ==. Instead use either the equals(...) method or equalsIgnoreCase(..).
For instance,
Java Code:<% String username=request.getParameter("username"); if (username.equalsIgnoreCase("tom")) { out.println("YES"); } else { out.println("NO"); } %>
Similar Threads
-
problem in j_security_check authentication
By Mrs. Deswal in forum NetworkingReplies: 2Last Post: 05-28-2009, 09:26 AM -
[SOLVED] How to do authentication
By Mrs. Deswal in forum NetworkingReplies: 8Last Post: 05-21-2009, 01:54 PM -
IIS Authentication
By akkarin in forum Java AppletsReplies: 0Last Post: 03-30-2009, 11:35 AM -
Form Based Authentication
By archmisha in forum Java ServletReplies: 1Last Post: 02-06-2009, 10:27 AM -
servlet filter authentication
By pradeepprathyu in forum Advanced JavaReplies: 0Last Post: 11-22-2008, 11:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks