You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Marinschek (JIRA)" <my...@incubator.apache.org> on 2005/05/24 11:24:00 UTC

[jira] Commented: (MYFACES-202) Date not modified with InputCalendar in dataTable

     [ http://issues.apache.org/jira/browse/MYFACES-202?page=comments#action_66152 ]
     
Martin Marinschek commented on MYFACES-202:
-------------------------------------------

Does that mean the value is not posted back to the server?

Did you try out the MyFaces examples? Can you get them to run on your machine, and see if these are working for you, there is a calendar example in there which uses the inputDate in a table?

> Date not modified with InputCalendar in dataTable
> -------------------------------------------------
>
>          Key: MYFACES-202
>          URL: http://issues.apache.org/jira/browse/MYFACES-202
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.0.9 beta
>     Reporter: Emeric Simonneau
>     Assignee: Martin Marinschek
>     Priority: Blocker

>
> Hello,
> I want to modified a list of date so I used the inputCalendar and the dataTable.
> Here is a part of my JSP :
>     <x:dataTable value="#{MyBean.dateList}" var="date">
>         <h:column>
>             <x:inputCalendar renderAsPopup="true" value="#{date}" />
>         </h:column>
>     </x:dataTable>
>     <br />
>     <x:commandButton id="submit" action="#{MyBean.submit}"
>         value="OK" />
> When I submit, the date of my dateList are not modified.
> I think the problem come from the correction of the issue "MYFACES-60" (The children components of the inputCalendar are removed in the encodeEnd), But also of the table which uses only one instance of the inputCalendar to update the dates.
> Perhaps this will be able to help you, I developed a component with a structure identical to inputCalendar. This component contains a list of String and shows as many inputText which it contains of String.
> It works fine except when I use it in dataTable, I have this exception (like issue "MYFACES-60"): 
> java.lang.ArrayIndexOutOfBoundsException: 1
>     org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:200)
>     org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:202)
>     org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:202)
>     org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:155)
>     org.apache.myfaces.component.html.ext.HtmlDataTableHack.setRowIndex(HtmlDataTableHack.java:71)
>     org.apache.myfaces.component.html.ext.HtmlDataTable.setRowIndex(HtmlDataTable.java:186)
>     org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:139)
>     javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
>     org.apache.myfaces.component.html.ext.HtmlDataTable.encodeChildren(HtmlDataTable.java:507)
>     javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:380)
>     javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:288)
>     org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:98)
>     org.apache.jsp.search$jsp._jspService(search$jsp.java:387)
>     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>     org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>     org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
>     org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:280)
>     org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
>     javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
>     org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)
> Here my component :
> public class InputConditionValue extends UIInput
> {
>     private static final String FIELD_SUFFIX     = "VALUE";
>     /////////////////////////////////////////////////////////////////
>     public DLInputConditionValue()
>     {
>         super();
>         setRendererType( null );
>     }
>     /////////////////////////////////////////////////////////////////
>     public String getFamily()
>     {
>         return "InputConditionValue";
>     }
>     /////////////////////////////////////////////////////////////////
>     public void encodeBegin( FacesContext facesContext )
>             throws IOException
>     {
>         getChildren().clear();
>         
>         Application application = facesContext.getApplication();
>         List valueList = (List) getValue();
>         int nField = 1;
>         Iterator it = valueList.iterator();
>         while ( it.hasNext() )
>         {
>             String value = (String) it.next();
>             if ( nField > 1 )
>             {
>                 MyOutputText outputText = (MyOutputText) application.createComponent( MyOutputText.COMPONENT_TYPE );
>                 outputText.setValue( " or " );
>                 getChildren().add( outputText );
>             }
>             String fieldId = getId() + FIELD_SUFFIX + nField;
>             MyOutputText inputText = (MyOutputText) application.createComponent( MyOutputText.COMPONENT_TYPE );
>             inputText.setId( fieldId );
>             inputText.setValue( value );
>             getChildren().add( inputText );
>             nField++;
>         }
>     }
>     /////////////////////////////////////////////////////////////////
>     /** @see javax.faces.component.UIComponent#decode(javax.faces.context.FacesContext) */
>     public void decode( FacesContext context )
>     {
>         super.decode( context );
>     }
>     /** @see javax.faces.component.UIInput#validate(javax.faces.context.FacesContext) */
>     public void validate( FacesContext context )
>     {
>         ArrayList values = new ArrayList();
>         Iterator childIt = getChildren().iterator();
>         while ( childIt.hasNext() )
>         {
>             Object childComponent = childIt.next();
>             
>             if( childComponent instanceof EditableValueHolder )
>             {
>                 values.add( ((EditableValueHolder) childComponent).getValue() );
>             }
>         }
>         setSubmittedValue( values );
>         
>         super.validate( context );
>     }
> }
> Thanks for your help and for all your work.
> Regards.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira