myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <andrew.rw.robin...@gmail.com>
Subject Re: [Trinidad] PPR and inputDate problems
Date Fri, 08 Feb 2008 22:13:09 GMT
I think I know your problem. It is a phase issue and why value change
listeners (VCL) suck in JSF (really bad architecture)

1. page submit
2. apply request values
finalMarkField decoded as "A" (for example)
withdrawalDate decoded as blank (I presume you are not setting this)
3. validation
finalMarkField is valid
  value change listener fired
  you set the value
withdrawalDate valid
4. update models
finalMarkField value saved
withdrawalDate value saved (overwritting the value you set in the value
change listener)
5. render (no change)

The VCL architecture sucks as it is not transaction aware, and the events
fired in the validation doesn't mean that the update will ever be done (so
the new value may never become the actual value). Also, when the VCL is
invoked, the model is not updated, so you can't trust values from the model
layer (beans) since they may have pending changes.

I haven't tried it, but add a <tr:subform> around each input. This should
only validate & update the value that has changed instead of the entire
form.

-Andrew




On Feb 8, 2008 1:14 PM, Shane Petroff <shane@mayet.ca> wrote:

>  Andrew Robinson wrote:
>
>
> What trinidad build are you using?
>
>
> Trinidad 1.0.5,
> MyFaces Core 1.1.5
>
>
> colons should not be necessary for components in the same naming
> container.
>
>
> Tried with and without. Using the colons clearly does not work because it
> issues the warning:
>
> WARNING: Could not find partial trigger :::finalMarkField from
> CoreInputDate[UIXEditableFacesBeanImpl, id=_idJsp12]
>
> With no preceding colons there is no warning generated, but the field is
> never refreshed either. The value change method is below, as is a stripped
> down jsp. I can see the value change being fired, but where would I even set
> a breakpoint to tell if anything is happening on the partialTriggers side?
>
>
>
>     public void finalMarkChanged( ValueChangeEvent event )
>     {
>         StudentSection ss = (StudentSection) m_Table.getRowData();
>         ss.setWithdrawalDate(new Date()); // I'm assuming that this
> instance is still around to refresh the field from
>         System.out.println( "finalMarkChanged for " + ss.getStudentName()
> + " " + ss.getWithdrawalDate() );
>     }
>
>
> <f:view>
>
> <tr:document title="#{bundle.ClassListHeader}">
>
> <body class="page-background">
>
> <h:form>
>
>   <h:panelGrid headerClass="page-header" styleClass="panel"
>                columns="1" cellpadding="5">
>
>     <h:messages showDetail="true" showSummary="false"
> styleClass="errors"/>
>
>     <h:dataTable styleClass="dataTable"
>                  rowClasses="list-row-even,list-row-odd" cellpadding="4"
> border="0"
>                  headerClass="list-header"
>                  cellspacing="0"
>                  value="#{classListBean.studentSections}"
>                  var="studentSec"
>                  binding="#{classListBean.table}">
>
>       <h:column>
>         <f:facet name="header">
>           <h:commandLink styleClass="table-header" id="studentDesc"
>                          actionListener="#{classListBean.sort}">
>             <h:outputText value="#{bundle.StudentColHeader}"/>
>           </h:commandLink>
>         </f:facet>
>         <h:outputText value="#{studentSec.studentName}"/>
>       </h:column>
>
>       <h:column>
>         <f:facet name="header">
>             <h:outputText value="#{bundle.ClassListFinalMarkHeader}"
> styleClass="label"/>
>         </f:facet>
>         <tr:inputText id="finalMarkField"
>                       columns="5"
>                       value="#{studentSec.finalMark}"
>                       autoSubmit="true"
>                       valueChangeListener="#{
> classListBean.finalMarkChanged}"/>
>       </h:column>
>
>       <h:column>
>         <f:facet name="header">
>             <h:outputText value="#{bundle.ClassListWithdrawalDateHeader}"
> styleClass="label"/>
>         </f:facet>
>         <tr:inputDate columns="11"
>                       partialTriggers=":::finalMarkField"
>                       value="#{studentSec.withdrawalDate}"
>                       required="false" >
>             <f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{
> configBundle.TimeZone}"/>
>         </tr:inputDate>
>       </h:column>
>
>     </h:dataTable>
>
>   </h:panelGrid>
>
> </h:form>
>
> </body>
>
> </tr:document>
>
> </f:view>
>
>
>
> On Feb 8, 2008 10:31 AM, Shane Petroff <shane@mayet.ca> wrote:
>
> > Matthias Wessendorf wrote:
> > > ah,
> > > I just noticed, that "finalMarkField" is inside a table (naming
> > container).
> > > haven't read your code carefully, sorry.
> > >
> > > can you *try* partialTriggers=":::finalMarkField" ?
> > >
> >
> >  No joy... cleared the browser cache first, then dumped tomcat's cache,
> > did a full build and restarted the server. I also tried :: and ::::
> > variants (3 does appear to be the correct number though based on the
> > generated html), but still no partial triggers refresh. Would it be more
> > likely to work if I switched to a tr:table?
> >
> > --
> > Shane
> >
> >
>  --
> Shane
>
>

Mime
View raw message