Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-23-2009, 08:53 AM
Member
 
Join Date: Oct 2009
Posts: 5
Rep Power: 0
KamilBek is on a distinguished road
Default How to use <f:convertdatetime> or<s:convertdatetime> for date in message
I have message with text and date. I want use date pattern for it and use <f:convertdatetime> but it used only when wrapper tag have only date as value. How to use my pattern?
<h: outputText value="Today is #{bean.date}!!!">
<f:convertdatetime pattern="dd.mm.yyyy"/>
</h: outputText>
don't work. How to solve it?

Last edited by KamilBek; 10-23-2009 at 08:55 AM.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 10-23-2009, 09:19 AM
Senior Member
 
Join Date: Aug 2009
Posts: 1,895
Rep Power: 2
r035198x is on a distinguished road
Default
Separate the text into two outPutText tags. One containing the text and the other the date value.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 10-23-2009, 09:43 AM
Member
 
Join Date: Oct 2009
Posts: 5
Rep Power: 0
KamilBek is on a distinguished road
Default
Yes, it is solution, but it make 2 <span> element in HTML, but I want make 1 <span> element.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 10-23-2009, 11:24 AM
Senior Member
 
Join Date: Aug 2009
Posts: 1,895
Rep Power: 2
r035198x is on a distinguished road
Default
Why do you want JSF to generate only 1? You shouldn't rely too much on those implementation details. They could change and leave your code no longer working.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 10-26-2009, 09:19 AM
Member
 
Join Date: Oct 2009
Posts: 5
Rep Power: 0
KamilBek is on a distinguished road
Default
I put it into <h: panelGrid> (it make table) and when I put two span in one cell, every span take new line, but they must be in one line. I can do it with css styles, but I think that it is worse than relying to implimentation of jsf tags.

Last edited by KamilBek; 10-26-2009 at 09:25 AM.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 10-26-2009, 09:21 AM
Senior Member
 
Join Date: Aug 2009
Posts: 1,895
Rep Power: 2
r035198x is on a distinguished road
Default
Don't put the span at all. Just put them in a panelGrid with two columns and they will be on line.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 10-26-2009, 09:55 AM
Member
 
Join Date: Oct 2009
Posts: 5
Rep Power: 0
KamilBek is on a distinguished road
Default
It must be in one cell of h: panelgrid.
if I put in this cell tag like:
<h: panelGrid>
<h: outputText value="Today is ">
<h: outputText value="#{bean.date}">
<f:convertdatetime pattern="dd.mm.yyyy"/>
</h: outputText>
<h: outputText value="!!!">
</h: panelGrid>

At first it will be new table and I think It not very good, and Second I already use some CSS styles for wrapper h: panelGrid, wich make big distance between cells. And in this situation text does not look well.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 10-26-2009, 10:01 AM
Senior Member
 
Join Date: Aug 2009
Posts: 1,895
Rep Power: 2
r035198x is on a distinguished road
Default
Did you read my response above?
<h: panelGrid columns="2" ...
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 10-26-2009, 10:15 AM
Member
 
Join Date: Oct 2009
Posts: 5
Rep Power: 0
KamilBek is on a distinguished road
Default
Yes, sorry I wrote wrong text. I mean
<h: panelGrid columns="3">
<h: outputText value="Today is ">
<h: outputText value="#{bean.date}">
<f:convertdatetime pattern="dd.mm.yyyy"/>
</h: outputText>
<h: outputText value="!!!">
</h: panelGrid>

but result is same
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 10-26-2009, 10:21 AM
Senior Member
 
Join Date: Aug 2009
Posts: 1,895
Rep Power: 2
r035198x is on a distinguished road
Default
You mean that code displays everything on its own line? Did you refresh/redeploy/restart?
They should all appear on the same line.

If all fails put all of them into a panelGroup.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Tags
converter, date, f:convertdatetime, jsf framework, jsf tags

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with <s:convertDateTime> raj18 Advanced Java 2 10-02-2009 09:56 AM
java.util.Date vs java.sql.Date Jack New To Java 4 04-05-2009 03:53 AM
Compare date input to database with current date hungleon88 Advanced Java 2 11-25-2008 09:10 AM
Creating a Gregorian Calendar using a Date object gives date - 1 prachi_goliwadekar New To Java 1 05-08-2008 09:32 PM
Difference between current date and anothe date vijay balusamy New To Java 1 04-16-2008 05:15 PM


All times are GMT +2. The time now is 05:38 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org