Java 将日历添加到JSF页面
有谁能帮助我如何在JSF页面中添加弹出式日历吗?我需要添加一个日历,用户将在其中选择日期,并且所选日期应显示在文本框中。有人能帮我实现rich faces日历吗?您可以按以下方式使用rich faces日历:-Java 将日历添加到JSF页面,java,html,jsf,Java,Html,Jsf,有谁能帮助我如何在JSF页面中添加弹出式日历吗?我需要添加一个日历,用户将在其中选择日期,并且所选日期应显示在文本框中。有人能帮我实现rich faces日历吗?您可以按以下方式使用rich faces日历:- <rich:calendar id="dtDOB" value="#{Bean.variableName}" styleClass="textBox" datePattern="dd-MMM-yyyy" required="true" label="#{Some
<rich:calendar id="dtDOB" value="#{Bean.variableName}" styleClass="textBox"
datePattern="dd-MMM-yyyy" required="true"
label="#{Something}" validator="Validator.Something" />
修改后的rich:日历应如下所示:-
@ManagedBean(name="Demo") //Annotation.You can also define this entry in faces-config.xml
@RequestScoped //Scope of the bean
public class TestDemo
{
private Date dtDateOfBirth;
public Date getDtDateOfBirth() {
return dtDateOfBirth;
}
public void setDtDateOfBirth(Date dtDateOfBirth) {
this.dtDateOfBirth = dtDateOfBirth;
}
}
<rich:calendar id="dtDOB" value="#{Demo.dtDateOfBirth}" styleClass="textBox"
datePattern="dd-MMM-yyyy" required="true"
label="#{Something}" validator="Validator.Something" />
如果您不想使用验证,请从rich:calendar标记中删除validator和required属性,因为我是spring web flow的新手,您能帮助我在支持bean中应该在哪里添加setter和getter吗。我不知道rich calendar工作我遇到以下错误:/WEB-INF/flows/helloFlow/mainpage.xhtml:ELResolver无法处理标识符为“Bean”的空基对象。答案中的Bean实际上是您的manageBean。您需要声明manageBean的名称,其作用域在faces-config.xml中,或者您可以使用注释。如果使用后者,您可以直接在Bean上使用manageBean属性。你的能手和二传手将在你的豆子里。