• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to avoid displaying 'null' in jsp

 
Madhu Sudhana
Ranch Hand
Posts: 127
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am retrieving data from data base and displaying the same in a jsp in String format.
but when there is no entry for the corresponding field it is getting displayed as null in the jsp.
How can I avoid that ?
I need to display an empty field if the corresponding value is null.
 
ankur rathi
Ranch Hand
Posts: 3830
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use if condition and put empty where it is null.

FE,

 
abhishek gowlikar
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here it is simple

when try to retrive the Field from Database,But the Field is Empty
Check the condition like

if(object.variable == null)
{
object.variable="";
}
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have a few utility methods defined in some utility class to get around this issue or anyother related issues.

Or using JSTL is your best bet.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic