Results 1 to 2 of 2

Thread: How can I prevent the word "null" from appearing in my HTML input text fields when I

  1. #1
    New Member rominekarte's Avatar
    Join Date
    Feb 2010
    Location
    Califonia
    Posts
    3

    Default How can I prevent the word "null" from appearing in my HTML input text fields when I

    You could make a simple wrapper function, like

    <%!
    String blanknull(String s) {
    return (s == null) ? \"\" : s;
    }
    %>

    then use it inside your JSP form, like

    <input type="text" name="lastName" value="<%=blanknull(lastName)% >" >

  2. #2
    New Member davidmoris's Avatar
    Join Date
    Jul 2011
    Location
    davidmoris
    Posts
    9

    Default

    You can use java.sql.ResultSet.wasNull (). This method indicates whether the last column read was SQL NULL. Call it once you've downloaded a column value. Print only the value returned when you wasNull () returns false.
    code
    String eight = rs.getString(8);
    if (rs.wasNull()) {
    out.print("the value I want to show when the column was null");
    } else {
    out.print(eight);
    }

Similar Threads

  1. Replies: 5
    Last Post: 22-06-16, 04:15 PM
  2. Replies: 0
    Last Post: 29-09-09, 05:29 AM
  3. will "shaurya" produce the same magic as "few good men"
    By samuelhenry in forum Hollywood Movie Reviews
    Replies: 2
    Last Post: 31-08-09, 01:07 PM
  4. "sheetal" ♠ a DB-ian helps me "ON" my DB's IM for AIM, Yahoo, & Skype
    By michaeldadona in forum Computers and Gadgets
    Replies: 0
    Last Post: 05-06-09, 04:14 AM
  5. "Idol" winner Cook scores digital hit with "Life"
    By TechNewsPoster in forum Bits and Bytes - Technology News
    Replies: 0
    Last Post: 31-05-08, 10:54 AM

Share this page with your friends

Share this page with your friends

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •