Good evening! Here is my problem:
I'm making a screen that has two calendars:
Theprogramwillreturnmealistcomprisingtheintervalbetweentwodates.Onedateisfromthefirstcalendar,andtheotherfromthesecondcalendar.
However,mycodebelowisnotworking.
<!DOCTYPEhtml><htmlxmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Sistema de Integração Moriah</title>
<style type="text/css">
#painel {
font-family: geneva, arial, helvetica, sans-serif;
font-size: 100%;
margin-top: 220px;
margin-left: 300px;
margin-right: 300px;
text-align: center;
}
#form {
padding-left: 60px;
}
</style>
</h:head>
<body>
<ui:decorate template="menubardecorate.xhtml"></ui:decorate>
<p:panel header="Selecione como deseja as Ordens de Serviço" id="painel">
<h:form id="form">
<h:panelGrid columns="5">
<p:outputLabel value="Datas da OS:" />
<p:outputLabel for="de" value="De:" />
<p:calendar id="de" value="#{ListaOsBean.dataDe}" mindate="01/01/10" maxdate="" update="ate" />
<p:outputLabel for="ate" value="Até:" />
<p:calendar id="ate" value="{ListaOsBean.dataAte}" mindate="#{ListaOsBean.getDataDe()}" maxdate="" />
</h:panelGrid>
</h:form>
</p:panel>
</body>
</html>
The "#{ListaOsBean.dataDe}"
is not receiving the date passed by the user, and is not returning to the other <p:calendar/>
in mindate="#{ListaOsBean.getDataDe()}"
.
What I want is that once I click on the date of the first calendar, only become available in the second calendar, the numbers after the date that I selected in the first. This way:
MyBeanlookslikethis:
packagebr.com.moriahitg.bean;importbr.com.moriahitg.dao.SZA990DAO;importbr.com.moriahitg.modelo.SZA990;importjava.util.ArrayList;importjava.util.Date;importjava.util.List;importjavax.faces.bean.ManagedBean;importjavax.faces.bean.SessionScoped;importjavax.faces.context.FacesContext;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpSession;@ManagedBean@SessionScopedpublicclassListaOsBean{List<SZA990>list=newArrayList<SZA990>();DatedataDe;StringdataDeS,dataAteS;@SuppressWarnings("unchecked")
public String addOSNaListaPorCliente() {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext()
.getRequest();
HttpSession session = request.getSession(true);
String a1_cod = (String) session.getAttribute("A1_COD");
SZA990DAO szadao = new SZA990DAO();
list = szadao.getOSPorCliente(a1_cod);
return "/listaDeOSs.xhtml?faces-redirect=true";
}
public List<SZA990> getList() {
return list;
}
public void setList(List<SZA990> list) {
this.list = list;
}
public Date getDataDe() {
return dataDe;
}
public void setDataDe(Date dataDe) {
this.dataDe = dataDe;
}
// public Date getDataAte() {
// return dataAte;
// }
// public void setDataAte(Date dataAte) {
// this.dataAte = dataAte;
// }
public String getDataDeS() {
return dataDeS;
}
public void setDataDeS(String dataDeS) {
this.dataDeS = dataDeS;
}
public String getDataAteS() {
return dataAteS;
}
public void setDataAteS(String dataAteS) {
this.dataAteS = dataAteS;
}
}
Should I use some listener, or ajax? Thank you in advance for the answer! I searched and did not find anything specific.