Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JSP prob?!?

Options
  • 15-03-2006 4:21pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    This is the code, basicly i want it to check the variable returned from getTitle and if it has nothin in it to print out 'Missing Title', its to work with a form and there will be more if statements for the other text fields but i cant get this to wor, i tried using syste.out.println but not sure if that only works on the console!?!?
    <td>
     <br>
    <%
    if (user.getTitle() == "")
    { %>Missing Title<% }
    %>
    </td>


Comments

  • Registered Users Posts: 130 ✭✭irishfeller


    That should work - except that you should change the =="" to .equals("").

    '==' doesn't work for strings.


  • Closed Accounts Posts: 255 ✭✭full forward


    hi,
    try using the word null instead of ""


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    nice one, got it, it was that i needed to use null instead, tanx!


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    you should really do a null check and an emptystring check
    though depending on the source of getTitle() maybe empty string is unpossible :D


Advertisement