2 Replies Latest reply on Oct 13, 2009 7:00 AM by sam-user

    Passing date with f:param problem

    sam-user

      Hello,
      I came across a problem when passing a date type using f:param.

      I have the following in my page:

      <rich:column sortBy="#{_inc.incIgnore}">
       <f:facet name="header">Ignore</f:facet>
       <h:selectBooleanCheckbox value="#{_inc.incIgnore}" >
       <a:support event="onclick" action="#{incHome.toggleIgnore}" >
       <f:param name="pIncId" value="#{_inc.id.incId}"/>
       <f:param name="pIncDate" value="#{_inc.id.incDate}" />
       </a:support>
       </h:selectBooleanCheckbox>
      </rich:column>


      and the following in my incHome class:

      @RequestParameter
      String pIncId;
      
      @RequestParameter
      Date pIncDate;
      
      public String toggleIgnore()
      {
       if(pIncId==null || pIncDate==null) return "";
       String logDetail;
       // do something
      }


      In my pages-config.xml I have this

      <converter>
       <converter-for-class>java.util.Date</converter-for-class>
       <converter-class>javax.faces.convert.DateTimeConverter</converter-class>
      </converter>



      The problem is that the pIncDate field doesn't seem to be passed back to incHome. It's always null.

      I did some googling and it seems that other people had the same problem, but I wasn't able to find a solution so far.

      Does anyone know if there's a fix for this problem or a workaround?
      I'm using richfaces 3.3.1GA.

      Thanks.

        • 1. Re: Passing date with f:param problem
          ilya_shaikovsky

          any facesMessages?

          • 2. Re: Passing date with f:param problem
            sam-user

            Not really.
            Although I can see this in the log file:

            [org.ajax4jsf.renderkit.AjaxRendererUtils] Build onclick string for component j_id388 as A4J.AJAX.Submit('_viewRoot','incsChildren',event,{'status':'waitStatus','similarityGroupingId':'incsChildren:incsTable:4:j_id388','parameters':{'pIncId':'125','pIncDate':{'date':8,'day':5,'hours':6,'minutes':26,'month':4,'nanos':0,'seconds':43,'time':1241760403000,'timezoneOffset':-60,'year':109} ,'incsChildren:incsTable:4:j_id388':'incsChildren:incsTable:4:j_id388'} ,'actionUrl':'/TEST/IncEdit.seam'} )


            If I'm interpreting this correctly, it seems that the date is passed, but for whatever reason the RequestParameter in incHome class does not get this value.

            Which makes me think that it could be seam that's causing the problem. In which case it's probably better to post this question on the Seam forum.

            Any help with this will be highly apreciated as I'm stuck with it.

            Thanks.