• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When have no record in the field

 
feng fu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem about my jsp page. when the field 'Name' doesn't have any record,I use <input name="Name" type="text" id="Name" value="<%= ResultSet.getString("Name") %>">, in the IE, inside text box, it show 'null'. What I should do to make it doesn't show anything inside the text box
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I would most certainly not be doing SQL on a JSP page or passing a result set to a JSP page, but the general problem is that when the result of a scriptlet expression is null, it translates to the string "null" in the output as you have discovered.
One solution is to do something along the lines of:

(assuming that the scripting variable 'whatever' is a String -- extrapolate to the approriate conersion if not)
 
feng fu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works, thanks a lot
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic