Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

f:param in h:outputFormat interpreting not-null value as null?  RSS feed

 
Henrique Sousa
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, guys
Today I have a rather annoying problem with a JSF tag. I am trying to format a date (which is actually an instance of java.sql.Timestamp) into text. Now, documentation says it works just like java.text.MessageFormat.format(String,Object[]), so I tried this:

Amazingly, this outputs "null". My first assumption was that I had used outputFormat wrongly, so I tried just outputText. Then I did just the expression and put all together:

This generated the following output:

The two first blank lines and "null" are the outputFormat. Then we have a blank for the outputText and valid values for the JSP expressions. I tested MessageFormat.format method and it only returns null if the parameter is an array with a null reference in the first position. I tried changing pattern to "dd/MM/yyyy HH:mm", but it was printed literally. Did I do anything wrong?
[ May 16, 2006: Message edited by: Henrique Sousa ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to give a name to your parameter.
 
Henrique Sousa
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right, I added the name and id attributes (in all combinations) and... nothing changed, sorry. By the way, I am running under JBoss 4.0.4 CR2 -- it contains MyFaces implementation version 1.1.1. Did anyone ever make this work with this library and version? Code samples?

Updating: when I added the id attribute to outputText and outputFormat the HTML code changed, as expected, to:

[ May 16, 2006: Message edited by: Henrique Sousa ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!