如何根据日期是否大于今天的日期来呈现JSF组件? [英] How can I render a JSF component based on if the date is greater than today's date?
本文介绍了如何根据日期是否大于今天的日期来呈现JSF组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从服务器端获取了一个日期,并且如何在xhtml代码中进行比较,因此,如果它小于今天的日期,我将渲染面板,否则不显示.
i get a date from server side and how do I compare this in my xhtml code, so that if it is less than today's date, I'll render the panel, otherwise not.
推荐答案
您可以在bean中有一个方法
You can have a method in your bean
class MyBean{
public boolean isDateBigger(){
//date comparissoin and return result
}
}
在XHTML上
render="#{myBean.dateBigger}"
更新:
根据您的评论,如果您想通过javascript完成此操作.
As per your comment, if you want to accomplish it through javascript then.
取两个隐藏参数. 当前一个千分之一,另一个代表您日期的千分之一
take two hidden parameter. One current millis and another representing your date's millis
使用javascript比较它们并应用DIV的样式visibility:hidden
隐藏
compare them using javascript and apply DIV's style visibility:hidden
to hide
这篇关于如何根据日期是否大于今天的日期来呈现JSF组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文