How can I render a JSF component based on if the d

2019-06-25 09:19发布

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.

2条回答
beautiful°
2楼-- · 2019-06-25 09:40

You can have a method in your bean

class MyBean{    
  public boolean isDateBigger(){
   //date comparissoin and return result
  }
}

on XHTML

render="#{myBean.dateBigger}"

Update:

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

compare them using javascript and apply DIV's style visibility:hidden to hide

查看更多
Summer. ? 凉城
3楼-- · 2019-06-25 09:52

try

{mbean.cardExpiryDate gt now}

查看更多
登录 后发表回答