File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes When have no record in the field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "When have no record in the field" Watch "When have no record in the field" New topic
Author

When have no record in the field

feng fu
Greenhorn

Joined: Feb 24, 2004
Posts: 8
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

Joined: Jan 10, 2002
Posts: 61202
    
  66

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)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
feng fu
Greenhorn

Joined: Feb 24, 2004
Posts: 8
It works, thanks a lot
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When have no record in the field