Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

JSP prob?!?

  • 15-03-2006 04:21PM
    #1
    Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭


    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, Registered Users 2 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, Registered Users 2 Posts: 1,991 ✭✭✭Ziycon


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


  • Registered Users, Registered Users 2 Posts: 27,514 ✭✭✭✭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