• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic