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"/>

             <% } %>

Recommended Answers

All 3 Replies

What are you trying to accomplish with

if ("name" == null)

Comparing a string literal to null will always be false.

trying to see is "name" null.

Well "name" (when you use quotes) is a value not a variable. So the value "name" will never be equal to the value null.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.