DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JSP (http://www.daniweb.com/forums/forum24.html)
-   -   Something small.. (http://www.daniweb.com/forums/thread96027.html)

idgeitman Nov 8th, 2007 4:19 pm
Something small..
 
Hello,

I've been trying to figure this out but still no luck, can anyone see what im doing wrong here?, the if statement just isn't working!

Thanks,


<% String name = request.getParameter("username"); %>

<% if ("name" == null)  { %>
  <jsp:forward page = "invalid.jsp"/>

            <% } %>

masijade Nov 8th, 2007 5:49 pm
Re: Something small..
 
What are you trying to accomplish with
if ("name" == null)
Comparing a string literal to null will always be false.

idgeitman Nov 8th, 2007 5:58 pm
Re: Something small..
 
trying to see is "name" null.

masijade Nov 9th, 2007 1:36 am
Re: Something small..
 
Well "name" (when you use quotes) is a value not a variable. So the value "name" will never be equal to the value null.


All times are GMT -4. The time now is 3:45 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC