You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by kal stevens <ka...@gmail.com> on 2007/02/06 20:12:09 UTC

JSF dataTable Binding

Could someone help me out and tell me what is wrong with this
I am trying to bind the current value through the iteration to my bean.

pgb.weekList is a List<Integer>
pgb.weekIndex is an Integer
pgb.daysOfWeek is a List<Integer>


        <x:dataTable
                 id="listTableView"
                 value="#{pgb.weekList}"
                 binding="#{pgb.weekIndex}"
                 var="row">
            <x:columns value="#{pgb.daysOfWeek}" var="column">
                <h:outputText value="("/>
                <h:outputText value="#{row}"/>
                <h:outputText value=","/>
                <h:outputText value="#{column}"/>
                <h:outputText value=")"/>
            </x:columns>
        </x:dataTable>

This is the output when I take out the binding
(0,0) (0,1) (0,2) (0,3) (0,4) (0,5) (0,6)
(1,0) (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)


I get the following exception
Caused by: javax.faces.el.EvaluationException: Bean: com.stevens.pgb.PGB,
property: weekIndex
        at org.apache.myfaces.el.PropertyResolverImpl.setProperty(
PropertyResolverImpl.java:410)
        at org.apache.myfaces.el.PropertyResolverImpl.setValue(
PropertyResolverImpl.java:173)
        ... 54 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.myfaces.el.PropertyResolverImpl.setProperty(
PropertyResolverImpl.java:406)
        ... 55 more

Re: JSF dataTable Binding

Posted by Andrew Robinson <an...@gmail.com>.
Just an FYI, to use less components you could shorten your use of
output text components to:

       <x:dataTable
                 id="listTableView"
                 value="#{pgb.weekList}"
                 binding="#{pgb.weekIndex }"
                 var="row">
            <x:columns value="#{pgb.daysOfWeek}" var="column">
                <h:outputText value="(#{row},#{column})"/>
            </x:columns>
        </x:dataTable>

Nothing to do with your problem, but just in case you didn't know EL
supports this.

On 2/6/07, kal stevens <ka...@gmail.com> wrote:
> Could someone help me out and tell me what is wrong with this
> I am trying to bind the current value through the iteration to my bean.
>
> pgb.weekList is a List<Integer>
>  pgb.weekIndex is an Integer
>  pgb.daysOfWeek is a List<Integer>
>
>
>         <x:dataTable
>                  id="listTableView"
>                  value="#{pgb.weekList}"
>                  binding="#{pgb.weekIndex }"
>                  var="row">
>             <x:columns value="#{pgb.daysOfWeek}" var="column">
>                 <h:outputText value="("/>
>                 <h:outputText value="#{row}"/>
>                 <h:outputText value=","/>
>                 <h:outputText value="#{column}"/>
>                 <h:outputText value=")"/>
>             </x:columns>
>         </x:dataTable>
>
> This is the output when I take out the binding
> (0,0) (0,1) (0,2) (0,3) (0,4) (0,5) (0,6)
> (1,0) (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)
>
>
> I get the following exception
>  Caused by: javax.faces.el.EvaluationException: Bean:
> com.stevens.pgb.PGB, property: weekIndex
>         at
> org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:410)
>         at
> org.apache.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:173)
>         ... 54 more
> Caused by: java.lang.IllegalArgumentException: argument
> type mismatch
>         at sun.reflect.NativeMethodAccessorImpl.invoke0
> (Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at
> org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:406)
>         ... 55 more
>
>

Re: JSF dataTable Binding

Posted by Simon Kitching <si...@rhe.co.nz>.
Once you have a binding to the UIData component, you can call the 
getRowIndex method on it.

However using binding and accessing UIData objects directly is not 
generally necessary. I suggest you find a book or article on using JSF 
tables to see if there is a better solution for whatever it is you are 
trying to achieve via this "weekIndex" value.

Regards,

Simon

kal stevens wrote:
> I wanted the integer to be accessible through my java code.
> I could make it a UIData I guess.
> But because the "Value" in the table was a list of integers, I wanted to 
> bind the value over which I am iterating to my bean.
> I also tried
> 
> <x:inputHidden value=#{row} binding="#{pgb.weekIndex}"/>
> 
> Is that not supported? is there a better way of doing it?
> I assumed that because my value was a List<Integer>, that the variable 
> "row" would be an Integer, and I could bind it to my bean.
> 
> Thanks
> 
> On 2/6/07, *Simon Kitching* <simon.kitching@rhe.co.nz 
> <ma...@rhe.co.nz>> wrote:
> 
>     kal stevens wrote:
>      > Could someone help me out and tell me what is wrong with this
>      > I am trying to bind the current value through the iteration to my
>     bean.
>      >
>      > pgb.weekList is a List<Integer>
>      > pgb.weekIndex is an Integer
>      > pgb.daysOfWeek is a List<Integer>
>      >
>      >
>      >         <x:dataTable
>      >                  id="listTableView"
>      >                  value="#{ pgb.weekList}"
>      >                  binding="#{pgb.weekIndex }"
>      >                  var="row">
> 
>     The binding attribute must point to a method like this:
>        public void setXXX(UIComponent component);
> 
>     In the case above, a UIData object will be passed to the method, ie the
>     object implementing the x:dataTable.
> 
>     I have no idea what you are trying to achieve by binding to some
>     Integer..
> 
>     Regards,
> 
>     Simon
> 
> 


Re: JSF dataTable Binding

Posted by kal stevens <ka...@gmail.com>.
WOW thank you very much.
I think the newspaper column is kind of what I was looking for.

We might be able to use the schedule tag, which will make it look much
nicer.

Thanks for your help.

On 2/6/07, Mike Kienenberger <mk...@gmail.com> wrote:
>
> By the way, the key class here is
> RowAndColumnRelationshipsBackingBean.java.   This is how your backing
> bean would be configured, with t:dataTable's value being your
> rowDataModel and t:columns's value being your columnDataModel.
>
> I have some more modern code using Facelets compositions rather than jsp:
>
>           <t:dataTable id="datatable"
>                        value="#{backingBean.rowDataModel}"
>                        var="row"
>                        rows="10"
>                        preserveDataModel="false"
>                        border="1">
>             <f:facet name="footer">
>                 <h:panelGroup>
>                     <h:commandButton value="Update"
> actionListener="#{backingBean.update}"/>
>                 </h:panelGroup>
>             </f:facet>
>             <h:column>
>                 <h:outputText value="#{row.rowName}"/>
>             </h:column>
>             <t:columns
>                 value="#{backingBean.columnDataModel}"
>                 var="column">
>               <f:facet name="header">
>                 <h:outputText value="#{column.columnName}"/>
>               </f:facet>
>               <h:selectBooleanCheckbox
> value="#{backingBean.relationshipValue}"/>
>             </t:columns>
>           </t:dataTable>
>
> Implement your own RowAndColumnRelationshipsDataModel instances.
>
> On 2/6/07, Mike Kienenberger <mk...@gmail.com> wrote:
> > No, t:dataTable and t:columns is the right approach.
> >
> > However, you probably need to bind both UIData components to your
> backing bean and call getRowData() on both to determine what to do.
> >
> > You can take a look at this ancient piece of code I wrote a couple of
> years ago that populates an nXm grid of checkboxes:
> >
> >
> http://issues.apache.org/jira/secure/attachment/12311217/RowAndColumnRelationshipComponent.zip
> >
> > Not everything in here is probably relevent to your situation (I was
> trying to write a custom component that handled the entire grid by
> compositing a bunch of components together in java code).
> >
> > However, the backing model should show you what you need to do.
> >
> > It's also possible that there's a far easier way to do what you're tying
> to do.
> >
> > If you're just trying to wrap an arbitrary number of elements, look into
> using the newspaperColumn attributes to turn an nX1 list of data into a
> nXconstant matrix of data.
> >
> > You might also look at the t:schedule component since it sounds like
> you're really trying to do some kind of calendar work :-)
> >
> >
> >
> >
> >
> > On 2/6/07,  kal stevens <ka...@gmail.com> wrote:
> > >  Ok, it sounds like dataTable might be the wrong tag for me.
> > > I have Core JavaServer Faces, but I did not see how to do this.
> > >
> > > I am basically trying to draw an NxM grid where the grid elements are
> custom elements.
> > >
> > > I tried panelGrid, but unless I misunderstand it can not take in a
> value or list to iterate over.
> > > So I tried to use a dataTable, and I was trying to access the nxm
> element.
> > > That was why I was trying to bind the integer index, because I could
> not find another way to get the nxm th element.
> > >
> > > I can display my own object if I can get it bound in the right place.
> > >
> > > So if in the display of the panel grid, I had a "item" that was bound
> to my object when displaying I could do what I wanted.
> > >  So lets say that I have an object Person which has a name field.
> > >
> > > So this is what I would want to do
> > >
> > > <h:panelGrid columns="7" value="${pgb.personBinding}" var="p">
> > >       <h:outputText value="#{p.name}"/>
> > > </h:panelGrid>
> > >
> > > To display
> > >
> > >
> > > harrypetertom
> > > sallykathybarbara
> > >  Does that make sense?
> > > It sounds like from this discussion that I am doing the wrong thing.
> > > So what am I missing
> > >
> > > Thanks
> > >
> > > Kal
> > >
> > >
> > >
> > > On 2/6/07, Mike Kienenberger  <mk...@gmail.com> wrote:
> > > >  > pgb.weekList  is a List<Integer>
> > > > > pgb.weekIndex is an Integer
> > > > > pgb.daysOfWeek is a List<Integer>
> > > > >
> > > > >
> > > > >         <x:dataTable
> > > > >                  id="listTableView"
> > > > >                  value="#{ pgb.weekList}"
> > > > >                  binding="#{pgb.weekIndex }"
> > > > >                  var="row">
> > > >
> > > > As you stated, row will indeed successively contain each of the
> > > > integers in weekList.
> > > > There's a number of ways to get at the current value of row, but
> you'd
> > > > need to tell us what you're hoping to accomplish before we can
> suggest
> > > > a method that will work best in your situation.
> > > >
> > > > As Simon stated, you can always bind the UIData component to your
> > > > backing bean, and then call uiData.getRowData().  getRowIndex() will
> > > > only give you the table row, and not necessarily the value of your
> > > > current integer in the list.
> > > >
> > > >
> > > >
> > > > On 2/6/07, kal stevens <  kalstevens@gmail.com> wrote:
> > > > > I wanted the integer to be accessible through my java code.
> > > > > I could make it a UIData I guess.
> > > > > But because the "Value" in the table was a list of integers, I
> wanted to
> > > > > bind the value over which I am iterating to my bean.
> > > > > I also tried
> > > > >
> > > > > <x:inputHidden value=#{row} binding="#{pgb.weekIndex}"/>
> > > > >
> > > > > Is that not supported? is there a better way of doing it?
> > > > > I assumed that because my value was a List<Integer>, that the
> variable "row"
> > > > > would be an Integer, and I could bind it to my bean.
> > > > >
> > > > > Thanks
> > > > >
> > > > >
> > > > > On 2/6/07, Simon Kitching < simon.kitching@rhe.co.nz> wrote:
> > > > > > kal stevens wrote:
> > > > > > > Could someone help me out and tell me what is wrong with this
> > > > > > > I am trying to bind the current value through the iteration to
> my bean.
> > > > > > >
> > > > > > > pgb.weekList is a List<Integer>
> > > > > > > pgb.weekIndex is an Integer
> > > > > > > pgb.daysOfWeek is a List<Integer>
> > > > > > >
> > > > > > >
> > > > > > >         <x:dataTable
> > > > > > >                  id="listTableView"
> > > > > > >                  value="#{ pgb.weekList}"
> > > > > > >                  binding="#{pgb.weekIndex }"
> > > > > > >                  var="row">
> > > > > >
> > > > > > The binding attribute must point to a method like this:
> > > > > >    public void setXXX(UIComponent component);
> > > > > >
> > > > > > In the case above, a UIData object will be passed to the method,
> ie the
> > > > > > object implementing the x:dataTable.
> > > > > >
> > > > > > I have no idea what you are trying to achieve by binding to some
> Integer..
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > Simon
> > > >   > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
> >
>

Re: JSF dataTable Binding

Posted by Mike Kienenberger <mk...@gmail.com>.
By the way, the key class here is
RowAndColumnRelationshipsBackingBean.java.   This is how your backing
bean would be configured, with t:dataTable's value being your
rowDataModel and t:columns's value being your columnDataModel.

I have some more modern code using Facelets compositions rather than jsp:

          <t:dataTable id="datatable"
                       value="#{backingBean.rowDataModel}"
                       var="row"
                       rows="10"
                       preserveDataModel="false"
                       border="1">
            <f:facet name="footer">
                <h:panelGroup>
                    <h:commandButton value="Update"
actionListener="#{backingBean.update}"/>
                </h:panelGroup>
            </f:facet>
            <h:column>
                <h:outputText value="#{row.rowName}"/>
            </h:column>
            <t:columns
                value="#{backingBean.columnDataModel}"
                var="column">
              <f:facet name="header">
                <h:outputText value="#{column.columnName}"/>
              </f:facet>
              <h:selectBooleanCheckbox
value="#{backingBean.relationshipValue}"/>
            </t:columns>
          </t:dataTable>

Implement your own RowAndColumnRelationshipsDataModel instances.

On 2/6/07, Mike Kienenberger <mk...@gmail.com> wrote:
> No, t:dataTable and t:columns is the right approach.
>
> However, you probably need to bind both UIData components to your backing bean and call getRowData() on both to determine what to do.
>
> You can take a look at this ancient piece of code I wrote a couple of years ago that populates an nXm grid of checkboxes:
>
> http://issues.apache.org/jira/secure/attachment/12311217/RowAndColumnRelationshipComponent.zip
>
> Not everything in here is probably relevent to your situation (I was trying to write a custom component that handled the entire grid by compositing a bunch of components together in java code).
>
> However, the backing model should show you what you need to do.
>
> It's also possible that there's a far easier way to do what you're tying to do.
>
> If you're just trying to wrap an arbitrary number of elements, look into using the newspaperColumn attributes to turn an nX1 list of data into a nXconstant matrix of data.
>
> You might also look at the t:schedule component since it sounds like you're really trying to do some kind of calendar work :-)
>
>
>
>
>
> On 2/6/07,  kal stevens <ka...@gmail.com> wrote:
> >  Ok, it sounds like dataTable might be the wrong tag for me.
> > I have Core JavaServer Faces, but I did not see how to do this.
> >
> > I am basically trying to draw an NxM grid where the grid elements are custom elements.
> >
> > I tried panelGrid, but unless I misunderstand it can not take in a value or list to iterate over.
> > So I tried to use a dataTable, and I was trying to access the nxm element.
> > That was why I was trying to bind the integer index, because I could not find another way to get the nxm th element.
> >
> > I can display my own object if I can get it bound in the right place.
> >
> > So if in the display of the panel grid, I had a "item" that was bound to my object when displaying I could do what I wanted.
> >  So lets say that I have an object Person which has a name field.
> >
> > So this is what I would want to do
> >
> > <h:panelGrid columns="7" value="${pgb.personBinding}" var="p">
> >       <h:outputText value="#{p.name}"/>
> > </h:panelGrid>
> >
> > To display
> >
> >
> > harrypetertom
> > sallykathybarbara
> >  Does that make sense?
> > It sounds like from this discussion that I am doing the wrong thing.
> > So what am I missing
> >
> > Thanks
> >
> > Kal
> >
> >
> >
> > On 2/6/07, Mike Kienenberger  <mk...@gmail.com> wrote:
> > >  > pgb.weekList  is a List<Integer>
> > > > pgb.weekIndex is an Integer
> > > > pgb.daysOfWeek is a List<Integer>
> > > >
> > > >
> > > >         <x:dataTable
> > > >                  id="listTableView"
> > > >                  value="#{ pgb.weekList}"
> > > >                  binding="#{pgb.weekIndex }"
> > > >                  var="row">
> > >
> > > As you stated, row will indeed successively contain each of the
> > > integers in weekList.
> > > There's a number of ways to get at the current value of row, but you'd
> > > need to tell us what you're hoping to accomplish before we can suggest
> > > a method that will work best in your situation.
> > >
> > > As Simon stated, you can always bind the UIData component to your
> > > backing bean, and then call uiData.getRowData().  getRowIndex() will
> > > only give you the table row, and not necessarily the value of your
> > > current integer in the list.
> > >
> > >
> > >
> > > On 2/6/07, kal stevens <  kalstevens@gmail.com> wrote:
> > > > I wanted the integer to be accessible through my java code.
> > > > I could make it a UIData I guess.
> > > > But because the "Value" in the table was a list of integers, I wanted to
> > > > bind the value over which I am iterating to my bean.
> > > > I also tried
> > > >
> > > > <x:inputHidden value=#{row} binding="#{pgb.weekIndex}"/>
> > > >
> > > > Is that not supported? is there a better way of doing it?
> > > > I assumed that because my value was a List<Integer>, that the variable "row"
> > > > would be an Integer, and I could bind it to my bean.
> > > >
> > > > Thanks
> > > >
> > > >
> > > > On 2/6/07, Simon Kitching < simon.kitching@rhe.co.nz> wrote:
> > > > > kal stevens wrote:
> > > > > > Could someone help me out and tell me what is wrong with this
> > > > > > I am trying to bind the current value through the iteration to my bean.
> > > > > >
> > > > > > pgb.weekList is a List<Integer>
> > > > > > pgb.weekIndex is an Integer
> > > > > > pgb.daysOfWeek is a List<Integer>
> > > > > >
> > > > > >
> > > > > >         <x:dataTable
> > > > > >                  id="listTableView"
> > > > > >                  value="#{ pgb.weekList}"
> > > > > >                  binding="#{pgb.weekIndex }"
> > > > > >                  var="row">
> > > > >
> > > > > The binding attribute must point to a method like this:
> > > > >    public void setXXX(UIComponent component);
> > > > >
> > > > > In the case above, a UIData object will be passed to the method, ie the
> > > > > object implementing the x:dataTable.
> > > > >
> > > > > I have no idea what you are trying to achieve by binding to some Integer..
> > > > >
> > > > > Regards,
> > > > >
> > > > > Simon
> > >   > >
> > > >
> > > >
> > >
> >
> >
>
>

Re: JSF dataTable Binding

Posted by Mike Kienenberger <mk...@gmail.com>.
No, t:dataTable and t:columns is the right approach.

However, you probably need to bind both UIData components to your backing
bean and call getRowData() on both to determine what to do.

You can take a look at this ancient piece of code I wrote a couple of years
ago that populates an nXm grid of checkboxes:

http://issues.apache.org/jira/secure/attachment/12311217/RowAndColumnRelationshipComponent.zip

Not everything in here is probably relevent to your situation (I was trying
to write a custom component that handled the entire grid by compositing a
bunch of components together in java code).

However, the backing model should show you what you need to do.

It's also possible that there's a far easier way to do what you're tying to
do.

If you're just trying to wrap an arbitrary number of elements, look into
using the newspaperColumn attributes to turn an nX1 list of data into a
nXconstant matrix of data.

You might also look at the t:schedule component since it sounds like you're
really trying to do some kind of calendar work :-)



On 2/6/07, kal stevens <ka...@gmail.com> wrote:
>
> Ok, it sounds like dataTable might be the wrong tag for me.
> I have Core JavaServer Faces, but I did not see how to do this.
>
> I am basically trying to draw an NxM grid where the grid elements are
> custom elements.
>
> I tried panelGrid, but unless I misunderstand it can not take in a value
> or list to iterate over.
> So I tried to use a dataTable, and I was trying to access the nxm element.
>
> That was why I was trying to bind the integer index, because I could not
> find another way to get the nxm th element.
>
> I can display my own object if I can get it bound in the right place.
>
> So if in the display of the panel grid, I had a "item" that was bound to
> my object when displaying I could do what I wanted.
>  So lets say that I have an object Person which has a name field.
>
> So this is what I would want to do
>
> <h:panelGrid columns="7" value="${pgb.personBinding}" var="p">
>      <h:outputText value="#{p.name}"/>
> </h:panelGrid>
>
> To display
>
> harrypetertomsallykathybarbara
> Does that make sense?
> It sounds like from this discussion that I am doing the wrong thing.
> So what am I missing
>
> Thanks
>
> Kal
>
> On 2/6/07, Mike Kienenberger <mk...@gmail.com> wrote:
> >
> > > pgb.weekList is a List<Integer>
> > > pgb.weekIndex is an Integer
> > > pgb.daysOfWeek is a List<Integer>
> > >
> > >
> > >         <x:dataTable
> > >                  id="listTableView"
> > >                  value="#{ pgb.weekList}"
> > >                  binding="#{pgb.weekIndex }"
> > >                  var="row">
> >
> > As you stated, row will indeed successively contain each of the
> > integers in weekList.
> > There's a number of ways to get at the current value of row, but you'd
> > need to tell us what you're hoping to accomplish before we can suggest
> > a method that will work best in your situation.
> >
> > As Simon stated, you can always bind the UIData component to your
> > backing bean, and then call uiData.getRowData().  getRowIndex() will
> > only give you the table row, and not necessarily the value of your
> > current integer in the list.
> >
> >
> >
> > On 2/6/07, kal stevens < kalstevens@gmail.com> wrote:
> > > I wanted the integer to be accessible through my java code.
> > > I could make it a UIData I guess.
> > > But because the "Value" in the table was a list of integers, I wanted
> > to
> > > bind the value over which I am iterating to my bean.
> > > I also tried
> > >
> > > <x:inputHidden value=#{row} binding="#{pgb.weekIndex}"/>
> > >
> > > Is that not supported? is there a better way of doing it?
> > > I assumed that because my value was a List<Integer>, that the variable
> > "row"
> > > would be an Integer, and I could bind it to my bean.
> > >
> > > Thanks
> > >
> > >
> > > On 2/6/07, Simon Kitching < simon.kitching@rhe.co.nz> wrote:
> > > > kal stevens wrote:
> > > > > Could someone help me out and tell me what is wrong with this
> > > > > I am trying to bind the current value through the iteration to my
> > bean.
> > > > >
> > > > > pgb.weekList is a List<Integer>
> > > > > pgb.weekIndex is an Integer
> > > > > pgb.daysOfWeek is a List<Integer>
> > > > >
> > > > >
> > > > >         <x:dataTable
> > > > >                  id="listTableView"
> > > > >                  value="#{ pgb.weekList}"
> > > > >                  binding="#{pgb.weekIndex }"
> > > > >                  var="row">
> > > >
> > > > The binding attribute must point to a method like this:
> > > >    public void setXXX(UIComponent component);
> > > >
> > > > In the case above, a UIData object will be passed to the method, ie
> > the
> > > > object implementing the x:dataTable.
> > > >
> > > > I have no idea what you are trying to achieve by binding to some
> > Integer..
> > > >
> > > > Regards,
> > > >
> > > > Simon
> > > >
> > >
> > >
> >
>
>

Re: JSF dataTable Binding

Posted by kal stevens <ka...@gmail.com>.
Ok, it sounds like dataTable might be the wrong tag for me.
I have Core JavaServer Faces, but I did not see how to do this.

I am basically trying to draw an NxM grid where the grid elements are custom
elements.

I tried panelGrid, but unless I misunderstand it can not take in a value or
list to iterate over.
So I tried to use a dataTable, and I was trying to access the nxm element.
That was why I was trying to bind the integer index, because I could not
find another way to get the nxm th element.

I can display my own object if I can get it bound in the right place.

So if in the display of the panel grid, I had a "item" that was bound to my
object when displaying I could do what I wanted.
 So lets say that I have an object Person which has a name field.

So this is what I would want to do

<h:panelGrid columns="7" value="${pgb.personBinding}" var="p">
     <h:outputText value="#{p.name}"/>
</h:panelGrid>

To display

harrypetertomsallykathybarbara
Does that make sense?
It sounds like from this discussion that I am doing the wrong thing.
So what am I missing

Thanks

Kal

On 2/6/07, Mike Kienenberger <mk...@gmail.com> wrote:
>
> > pgb.weekList is a List<Integer>
> > pgb.weekIndex is an Integer
> > pgb.daysOfWeek is a List<Integer>
> >
> >
> >         <x:dataTable
> >                  id="listTableView"
> >                  value="#{pgb.weekList}"
> >                  binding="#{pgb.weekIndex }"
> >                  var="row">
>
> As you stated, row will indeed successively contain each of the
> integers in weekList.
> There's a number of ways to get at the current value of row, but you'd
> need to tell us what you're hoping to accomplish before we can suggest
> a method that will work best in your situation.
>
> As Simon stated, you can always bind the UIData component to your
> backing bean, and then call uiData.getRowData().  getRowIndex() will
> only give you the table row, and not necessarily the value of your
> current integer in the list.
>
>
>
> On 2/6/07, kal stevens <ka...@gmail.com> wrote:
> > I wanted the integer to be accessible through my java code.
> > I could make it a UIData I guess.
> > But because the "Value" in the table was a list of integers, I wanted to
> > bind the value over which I am iterating to my bean.
> > I also tried
> >
> > <x:inputHidden value=#{row} binding="#{pgb.weekIndex}"/>
> >
> > Is that not supported? is there a better way of doing it?
> > I assumed that because my value was a List<Integer>, that the variable
> "row"
> > would be an Integer, and I could bind it to my bean.
> >
> > Thanks
> >
> >
> > On 2/6/07, Simon Kitching <si...@rhe.co.nz> wrote:
> > > kal stevens wrote:
> > > > Could someone help me out and tell me what is wrong with this
> > > > I am trying to bind the current value through the iteration to my
> bean.
> > > >
> > > > pgb.weekList is a List<Integer>
> > > > pgb.weekIndex is an Integer
> > > > pgb.daysOfWeek is a List<Integer>
> > > >
> > > >
> > > >         <x:dataTable
> > > >                  id="listTableView"
> > > >                  value="#{ pgb.weekList}"
> > > >                  binding="#{pgb.weekIndex }"
> > > >                  var="row">
> > >
> > > The binding attribute must point to a method like this:
> > >    public void setXXX(UIComponent component);
> > >
> > > In the case above, a UIData object will be passed to the method, ie
> the
> > > object implementing the x:dataTable.
> > >
> > > I have no idea what you are trying to achieve by binding to some
> Integer..
> > >
> > > Regards,
> > >
> > > Simon
> > >
> >
> >
>

Re: JSF dataTable Binding

Posted by Mike Kienenberger <mk...@gmail.com>.
> pgb.weekList is a List<Integer>
> pgb.weekIndex is an Integer
> pgb.daysOfWeek is a List<Integer>
>
>
>         <x:dataTable
>                  id="listTableView"
>                  value="#{pgb.weekList}"
>                  binding="#{pgb.weekIndex }"
>                  var="row">

As you stated, row will indeed successively contain each of the
integers in weekList.
There's a number of ways to get at the current value of row, but you'd
need to tell us what you're hoping to accomplish before we can suggest
a method that will work best in your situation.

As Simon stated, you can always bind the UIData component to your
backing bean, and then call uiData.getRowData().  getRowIndex() will
only give you the table row, and not necessarily the value of your
current integer in the list.



On 2/6/07, kal stevens <ka...@gmail.com> wrote:
> I wanted the integer to be accessible through my java code.
> I could make it a UIData I guess.
> But because the "Value" in the table was a list of integers, I wanted to
> bind the value over which I am iterating to my bean.
> I also tried
>
> <x:inputHidden value=#{row} binding="#{pgb.weekIndex}"/>
>
> Is that not supported? is there a better way of doing it?
> I assumed that because my value was a List<Integer>, that the variable "row"
> would be an Integer, and I could bind it to my bean.
>
> Thanks
>
>
> On 2/6/07, Simon Kitching <si...@rhe.co.nz> wrote:
> > kal stevens wrote:
> > > Could someone help me out and tell me what is wrong with this
> > > I am trying to bind the current value through the iteration to my bean.
> > >
> > > pgb.weekList is a List<Integer>
> > > pgb.weekIndex is an Integer
> > > pgb.daysOfWeek is a List<Integer>
> > >
> > >
> > >         <x:dataTable
> > >                  id="listTableView"
> > >                  value="#{ pgb.weekList}"
> > >                  binding="#{pgb.weekIndex }"
> > >                  var="row">
> >
> > The binding attribute must point to a method like this:
> >    public void setXXX(UIComponent component);
> >
> > In the case above, a UIData object will be passed to the method, ie the
> > object implementing the x:dataTable.
> >
> > I have no idea what you are trying to achieve by binding to some Integer..
> >
> > Regards,
> >
> > Simon
> >
>
>

Re: JSF dataTable Binding

Posted by kal stevens <ka...@gmail.com>.
I wanted the integer to be accessible through my java code.
I could make it a UIData I guess.
But because the "Value" in the table was a list of integers, I wanted to
bind the value over which I am iterating to my bean.
I also tried

<x:inputHidden value=#{row} binding="#{pgb.weekIndex}"/>

Is that not supported? is there a better way of doing it?
I assumed that because my value was a List<Integer>, that the variable "row"
would be an Integer, and I could bind it to my bean.

Thanks

On 2/6/07, Simon Kitching <si...@rhe.co.nz> wrote:
>
> kal stevens wrote:
> > Could someone help me out and tell me what is wrong with this
> > I am trying to bind the current value through the iteration to my bean.
> >
> > pgb.weekList is a List<Integer>
> > pgb.weekIndex is an Integer
> > pgb.daysOfWeek is a List<Integer>
> >
> >
> >         <x:dataTable
> >                  id="listTableView"
> >                  value="#{pgb.weekList}"
> >                  binding="#{pgb.weekIndex }"
> >                  var="row">
>
> The binding attribute must point to a method like this:
>    public void setXXX(UIComponent component);
>
> In the case above, a UIData object will be passed to the method, ie the
> object implementing the x:dataTable.
>
> I have no idea what you are trying to achieve by binding to some Integer..
>
> Regards,
>
> Simon
>

Re: JSF dataTable Binding

Posted by Simon Kitching <si...@rhe.co.nz>.
kal stevens wrote:
> Could someone help me out and tell me what is wrong with this
> I am trying to bind the current value through the iteration to my bean.
> 
> pgb.weekList is a List<Integer>
> pgb.weekIndex is an Integer
> pgb.daysOfWeek is a List<Integer>
> 
> 
>         <x:dataTable
>                  id="listTableView"
>                  value="#{pgb.weekList}"
>                  binding="#{pgb.weekIndex }"
>                  var="row">

The binding attribute must point to a method like this:
   public void setXXX(UIComponent component);

In the case above, a UIData object will be passed to the method, ie the 
object implementing the x:dataTable.

I have no idea what you are trying to achieve by binding to some Integer..

Regards,

Simon