problem passing date type as page parameter
davestar Jul 17, 2009 5:51 PMI'm trying to filter a listPage by date and userid. From a datatable the selected userid and date value is passed to the listPage with the f:param tag. The list page shows an error that says value must be a date
and the filter doesnt work. It works if its just filtered by userid without the date. What could I be doing wrong? or How can I get this to work? I've also tried using the JBoss seam date converter that doesnt work too.
Heres my code
firstPage.xhtml
<h:column> <f:facet name="header">Date</f:facet> <h:outputText value="#{_auditEventFact[3]}"> </h:outputText> </h:column> <rich:column styleClass="action"> <f:facet name="header">Action</f:facet> <s:link value="View" view="/AuditEventFactList.xhtml" action="#{auditEventFactList.lookUpUserAuditRecords()}"> <f:param name="userid" value="#{_auditEventFact[1]}"/> <f:param name="ntimestamp" value="#{_auditEventFact[3]}"/> </s:link> </rich:column>
pages.xml
<param name="from"/> <param name="userid" value="#{auditEventFactList.auditEventFact.userid}"/> <param name="ntimestamp" value="#{auditEventFactList.auditEventFact.ntimestamp}" converterId="javax.faces.DateTime"/>
ListAction.java
private static final String EJBQL = "select auditEventFact from AuditEventFact auditEventFact"; private static final String[] RESTRICTIONS = { "lower(auditEventFact.userid) like concat(lower(#{auditEventFactList.auditEventFact.userid}),'%')", "auditEventFact.ntimestamp = #{auditEventFactList.auditEventFact.ntimestamp}", "lower(auditEventFact.auditid) like concat(lower(#{auditEventFactList.auditEventFact.auditid}),'%')", }; private AuditEventFact auditEventFact = new AuditEventFact(); public AuditEventFactList() { setEjbql(EJBQL); setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS)); setMaxResults(25); }
EntityBean.java
@Temporal(TemporalType.TIMESTAMP) @Column(name="NTIMESTAMP#", length=11) public Date getNtimestamp() { return this.ntimestamp1; } public void setNtimestamp(Date ntimestamp1) { this.ntimestamp1 = ntimestamp1; }