[richfaces-issues] [JBoss JIRA] (RF-12032) rich:calendar: add support for sql.Date

Brian Leathem (JIRA) jira-events at lists.jboss.org
Mon Apr 2 11:58:47 EDT 2012


     [ https://issues.jboss.org/browse/RF-12032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Leathem updated RF-12032:
-------------------------------

          Summary: rich:calendar: add support for sql.Date  (was: rich:calendar : Ajax request - Error message enhancement - sql.Date)
    Fix Version/s: 4.3-Tracking
      Description: 
Adapt the rich:calendar component to work with [java.sql.Date|http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html] which extends [java.util.Date|http://docs.oracle.com/javase/6/docs/api/java/util/Date.html]

----

{panel:title=Original problem report}
When a backing-bean have a type of sql.Date which is mapped to a rich:calendar, there is an conversion error due to the rich:calendar component uses util.Date by default. Unfortunately, we do not see any error message at the screen when an ajax request is sent and returned back to us.

What we got, and thanks to Firebug, is the text below as an answer from our Ajax request POST. Nothing is rendered at the screen and the method of the backing bean is not called.

{code}
<?xml version='1.0' encoding='UTF-8'?>
<partial-response><error><error-name>class javax.faces.component.UpdateModelException</error-name><error-message><![CDATA[/pages/client/createClient.xhtml @479,230 value="#{phoneBean.effectiveDate}": Cannot convert 12-03-08 00:00 of type class java.util.Date to class java.sql.Date]]></error-message></error></partial-response>
{code}

Our code looks like this (we remove unecessary field and decoration):
{code}
<a4j:outputPanel id="phone-container" styleClass="panel-command-container" layout="block">
  <!--               -->
  <!--   ADD PHONE   -->
  <!--               -->
  <h:commandLink id="add-phone"
              value="#{msg['common.command.add.phone']}"
             action="#{createClientController.doAddPhone}">
    <f:ajax render="phone-container" execute="phone-container" />
  </h:commandLink>

  <c:forEach items="#{createClientController.phoneBeans}" var="phoneBean" varStatus="status">
    <h:panelGrid styleClass="header">
      <h:outputLabel value="#{msg['create.client.effective.label']}" styleClass="required" />
      <h:panelGroup>
	<rich:calendar id="effective-#{status.index}"
                    value="#{phoneBean.effectiveDate}"
                    popup="true"
          showApplyButton="false"
        enableManualInput="true"
              datePattern="#{msg['client.date.format']}"
                inputSize="12"
               styleClass="calendar">
          <f:ajax event="inputchange" render="@this" />
        </rich:calendar>
        <h:message id="effective-msg-#{status.index}" for="effective-#{status.index}" styleClass="rf-msg-err" />
      </h:panelGroup>
    </h:panelGrid>
  </c:forEach>
</a4j:outputPanel>     
{code}

Is is possible to have a message returned back to the UI??? or is there a way to handle this error properly?

Other information
=================
The form is inside a dynamic tab - Fragment are also include dynamically - we use c:if et subView as shown below:

{code}
<c:if test="#{tab.id eq desktopTabController.activeTab}">
  <f:subview id="#{tab.id}-subView">
    <ui:include src="#{tab.xhtmlFile}" />
  </f:subview>
</c:if>
{code}

{panel}

  was:
When a backing-bean have a type of sql.Date which is mapped to a rich:calendar, there is an conversion error due to the rich:calendar component uses util.Date by default. Unfortunately, we do not see any error message at the screen when an ajax request is sent and returned back to us.

What we got, and thanks to Firebug, is the text below as an answer from our Ajax request POST. Nothing is rendered at the screen and the method of the backing bean is not called.

{code}
<?xml version='1.0' encoding='UTF-8'?>
<partial-response><error><error-name>class javax.faces.component.UpdateModelException</error-name><error-message><![CDATA[/pages/client/createClient.xhtml @479,230 value="#{phoneBean.effectiveDate}": Cannot convert 12-03-08 00:00 of type class java.util.Date to class java.sql.Date]]></error-message></error></partial-response>
{code}

Our code looks like this (we remove unecessary field and decoration):
{code}
<a4j:outputPanel id="phone-container" styleClass="panel-command-container" layout="block">
  <!--               -->
  <!--   ADD PHONE   -->
  <!--               -->
  <h:commandLink id="add-phone"
              value="#{msg['common.command.add.phone']}"
             action="#{createClientController.doAddPhone}">
    <f:ajax render="phone-container" execute="phone-container" />
  </h:commandLink>

  <c:forEach items="#{createClientController.phoneBeans}" var="phoneBean" varStatus="status">
    <h:panelGrid styleClass="header">
      <h:outputLabel value="#{msg['create.client.effective.label']}" styleClass="required" />
      <h:panelGroup>
	<rich:calendar id="effective-#{status.index}"
                    value="#{phoneBean.effectiveDate}"
                    popup="true"
          showApplyButton="false"
        enableManualInput="true"
              datePattern="#{msg['client.date.format']}"
                inputSize="12"
               styleClass="calendar">
          <f:ajax event="inputchange" render="@this" />
        </rich:calendar>
        <h:message id="effective-msg-#{status.index}" for="effective-#{status.index}" styleClass="rf-msg-err" />
      </h:panelGroup>
    </h:panelGrid>
  </c:forEach>
</a4j:outputPanel>     
{code}

Is is possible to have a message returned back to the UI??? or is there a way to handle this error properly?

Other information
=================
The form is inside a dynamic tab - Fragment are also include dynamically - we use c:if et subView as shown below:

{code}
<c:if test="#{tab.id eq desktopTabController.activeTab}">
  <f:subview id="#{tab.id}-subView">
    <ui:include src="#{tab.xhtmlFile}" />
  </f:subview>
</c:if>
{code}


      Component/s: component-input


Rewrote the title and description asking for java.sql.Date support for the rich:calendar
                
> rich:calendar: add support for sql.Date
> ---------------------------------------
>
>                 Key: RF-12032
>                 URL: https://issues.jboss.org/browse/RF-12032
>             Project: RichFaces
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: component-input
>         Environment: cssparser-0.9.6 - guava-11.0.1 - hibernate-validator-4.2.0.Final - JSF/Mojarra 2.1.6 - springframework-3.0.6.RELEASE - richfaces-4.2.0.Final - sac-1.3.jar - Windows 7, WAS 8.0.0.1, Servlet 2.5 - Java 6.
>            Reporter: Jean ANDRE
>              Labels: waiting_on_user
>             Fix For: 4.3-Tracking
>
>         Attachments: rich_calendar_errorMsg_Enhancement.png
>
>
> Adapt the rich:calendar component to work with [java.sql.Date|http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html] which extends [java.util.Date|http://docs.oracle.com/javase/6/docs/api/java/util/Date.html]
> ----
> {panel:title=Original problem report}
> When a backing-bean have a type of sql.Date which is mapped to a rich:calendar, there is an conversion error due to the rich:calendar component uses util.Date by default. Unfortunately, we do not see any error message at the screen when an ajax request is sent and returned back to us.
> What we got, and thanks to Firebug, is the text below as an answer from our Ajax request POST. Nothing is rendered at the screen and the method of the backing bean is not called.
> {code}
> <?xml version='1.0' encoding='UTF-8'?>
> <partial-response><error><error-name>class javax.faces.component.UpdateModelException</error-name><error-message><![CDATA[/pages/client/createClient.xhtml @479,230 value="#{phoneBean.effectiveDate}": Cannot convert 12-03-08 00:00 of type class java.util.Date to class java.sql.Date]]></error-message></error></partial-response>
> {code}
> Our code looks like this (we remove unecessary field and decoration):
> {code}
> <a4j:outputPanel id="phone-container" styleClass="panel-command-container" layout="block">
>   <!--               -->
>   <!--   ADD PHONE   -->
>   <!--               -->
>   <h:commandLink id="add-phone"
>               value="#{msg['common.command.add.phone']}"
>              action="#{createClientController.doAddPhone}">
>     <f:ajax render="phone-container" execute="phone-container" />
>   </h:commandLink>
>   <c:forEach items="#{createClientController.phoneBeans}" var="phoneBean" varStatus="status">
>     <h:panelGrid styleClass="header">
>       <h:outputLabel value="#{msg['create.client.effective.label']}" styleClass="required" />
>       <h:panelGroup>
> 	<rich:calendar id="effective-#{status.index}"
>                     value="#{phoneBean.effectiveDate}"
>                     popup="true"
>           showApplyButton="false"
>         enableManualInput="true"
>               datePattern="#{msg['client.date.format']}"
>                 inputSize="12"
>                styleClass="calendar">
>           <f:ajax event="inputchange" render="@this" />
>         </rich:calendar>
>         <h:message id="effective-msg-#{status.index}" for="effective-#{status.index}" styleClass="rf-msg-err" />
>       </h:panelGroup>
>     </h:panelGrid>
>   </c:forEach>
> </a4j:outputPanel>     
> {code}
> Is is possible to have a message returned back to the UI??? or is there a way to handle this error properly?
> Other information
> =================
> The form is inside a dynamic tab - Fragment are also include dynamically - we use c:if et subView as shown below:
> {code}
> <c:if test="#{tab.id eq desktopTabController.activeTab}">
>   <f:subview id="#{tab.id}-subView">
>     <ui:include src="#{tab.xhtmlFile}" />
>   </f:subview>
> </c:if>
> {code}
> {panel}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list