• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to set ' - -' if there is no value for that column??

 
gopal kishan
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using jsf. i need to display the result to the user based on search condition.

ex: i want to display "EMPID", "EMPNAME" "DEPT".

if there is no value for one column i want to set "--" value.

how to do this in JSF???

thanks in advance
Gopal
 
gopal kishan
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi can anybody tell me how to set '--' if the column value return null

how will you use if condition in jsp page using jsf.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could write a custom javax.faces.convert.Converter for that. For example, if you had Date fields that were nullable, you could define a custom DateConverter and even register it as the default converter for Dates.
 
gopal kishan
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeff,

Thanks for the reply.

But the JSF document shows that converter used to convert values to particular datatypes.

but in my situation, i getting the result from the database and i want to show it to the user.

if any column does not contain value , then i need to show "--" instead of blank.

how will you do this???
 
gopal kishan
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi jeff,

I got my desired output. I tried like this it works fine.

<h:column>
<h utputText value="--" rendered="#{ListName.propertyValue==null}">
</h utputText>
<h utputText value="#{ListName.propertyValue}" rendered="#{ListName.propertyValue!=null}"></h utputText>
</h:column>

here ListName is the arraylist which hold the values and
propertyValue is the bean property.

cheers
Gopal
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic