This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to avoid displaying 'null' in jsp

 
Madhu Sudhana
Ranch Hand
Posts: 127
  • 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
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic