在JSF中显示服务器的启动时间 [英] Display server starting time in JSF

查看:56
本文介绍了在JSF中显示服务器的启动时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OmniFaces展示站点的脚注中(滚动至页面底部).

As seen on footer of the OmniFaces showcase site (scroll to very bottom of page).

服务器(重新)从UTC 2015年6月12日08:50开始

Server (re)started at 12 Jun 2015 08:50 UTC

如果可能的话,如何显示上次服务器重新启动/启动或/和quellcode的最新更新的时间.

How can I display the time of the last server restart/start or/and the last update of the quellcode, if it is possible.

推荐答案

OmniFaces展示柜也是开源.您可以在

The OmniFaces showcase is also open source. You can find the responsible code in line 100 of /WEB-INF/templates/layout.xhtml

<p>Server (re)started at #{of:formatDateWithTimezone(startup, 'd MMM yyyy HH:mm', 'UTC')} UTC</p>

因此,它使用OmniFaces自己的 #{startup}托管bean 对此进行了注册,基本上如下在OmniFaces自己的 :

It's thus using OmniFaces own #{startup} managed bean for this which is basically registered as below in OmniFaces own faces-config.xml:

<managed-bean eager="true">
    <managed-bean-name>startup</managed-bean-name>
    <managed-bean-class>java.util.Date</managed-bean-class>
    <managed-bean-scope>application</managed-bean-scope>
</managed-bean>

在普通JSF"中,您可以将其显示如下:

In "plain JSF" you could show it as below:

<h:outputText value="#{startup}">
    <f:convertDateTime pattern="d MMM yyyy HH:mm" />
</h:outputText>

这篇关于在JSF中显示服务器的启动时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆