You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andreas Zeller - zit-systems <an...@zit-systems.de> on 2006/03/26 18:53:06 UTC

Re: How i can show current timeStamp in jsf

Hey Legolas,

Timestamp? java.util.Calendar.getInstance().getTime() will give you the
current time and date... Does that help you?

Andreas

Legolas Woodland wrote:

> Hi
> Thank you for reading my post
> How i can show current timestamp in jsf ?
>
> thanks
>
>


Re: How i can show current timeStamp in jsf

Posted by Andreas Zeller - zit-systems <an...@zit-systems.de>.
Whoops :)

That was wrong. --> Then access the value in JSF like <t:outputText
value="#{timeBean.getDate}" />

The "get" disappears of course. So you'd just write <t:outputText
value="#{timeBean.date}" /> in your jsf page... There are lots of other
examples.

Did you check http://irian.at/myfaces ?

Legolas Woodland wrote:

> Andreas Zeller - zit-systems wrote:
>
>>Hey Legolas,
>>
>>Timestamp? java.util.Calendar.getInstance().getTime() will give you the
>>current time and date... Does that help you?
>>
>>Andreas
>>
>>Legolas Woodland wrote:
>>
>>  
>>
>>>Hi
>>>Thank you for reading my post
>>>How i can show current timestamp in jsf ?
>>>
>>>thanks
>>>
>>>
>>>    
>>>
>>
>>
>>  
>>
> Hi
> Thank you for the reply.
> I mean how i can print it in a jsf page.
> imagine that i have a jsf page and i want to show current timestamp ,
> what should i do ,can you give me a sample ?
>


Re: How i can show current timeStamp in jsf

Posted by Andreas Zeller - zit-systems <an...@zit-systems.de>.
Well sure,

I don't quite understand what exactly you need for your output. It's
just a simple getter for a bean... But anyway... To just put out the
current time and date, create a bean like TimeBean.java

import java.util.Calendar;

... etc. blabla

public String getDate(){
    return Calendar.getInstance().getTime().toString();
}

In faces-config.xml you need to map your TimeBean.java to for example
timeBean...

Then access the value in JSF like <t:outputText
value="#{timeBean.getDate}" />


I didn't check/run the code snipplets, just wrote them down in this
e-mail, so perhaps you need to correct some method names, but I think
it's fine this way and working.

Give it a try.

Andreas



Legolas Woodland wrote:

> Andreas Zeller - zit-systems wrote:
>
>>Hey Legolas,
>>
>>Timestamp? java.util.Calendar.getInstance().getTime() will give you the
>>current time and date... Does that help you?
>>
>>Andreas
>>
>>Legolas Woodland wrote:
>>
>>  
>>
>>>Hi
>>>Thank you for reading my post
>>>How i can show current timestamp in jsf ?
>>>
>>>thanks
>>>
>>>
>>>    
>>>
>>
>>
>>  
>>
> Hi
> Thank you for the reply.
> I mean how i can print it in a jsf page.
> imagine that i have a jsf page and i want to show current timestamp ,
> what should i do ,can you give me a sample ?
>


Re: How i can show current timeStamp in jsf

Posted by Legolas Woodland <le...@gmail.com>.
Andreas Zeller - zit-systems wrote:
> Hey Legolas,
>
> Timestamp? java.util.Calendar.getInstance().getTime() will give you the
> current time and date... Does that help you?
>
> Andreas
>
> Legolas Woodland wrote:
>
>   
>> Hi
>> Thank you for reading my post
>> How i can show current timestamp in jsf ?
>>
>> thanks
>>
>>
>>     
>
>
>   
Hi
Thank you for the reply.
I mean how i can print it in a jsf page.
imagine that i have a jsf page and i want to show current timestamp , 
what should i do ,can you give me a sample ?