Yes, the O'Reilly book has a chapter called "Working with Tabular Data" and a section within it called "Processing Row-Specific Events." Just beware of the one bug in the example code that I mentioned earlier in this thread, and make sure to do a <t:saveState> on your carListBean. I haven't worked with the example in the book for several months, so I'll have to go back to it and try to duplicate the problems Kevin says he has encountered; we haven't noticed any problems in our applications, but there may be some anomalies we're not aware of.
- Brendan -----Original Message----- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Monday, August 29, 2005 7:43 PM To: MyFaces Discussion Subject: Re: Concerning DataModel usage plus overhead? Thanks Brendan! This below looks wonderful. At home now and no time to try it, but will tomorrow from work. By the way, does the O'Reilly book present something like the below? This is the exact kind of example that I think would be very useful to see in a mini-demo-app. On 8/29/05, CONNER, BRENDAN (SBCSI) <[EMAIL PROTECTED]> wrote: > Sounds good. Judging from what I understand about your e-mail, I'd > define something like: > > <managed-bean> > <managed-bean-name>carListBean</managed-bean-name> > > <managed-bean-class>com.mycompany.CarListBean</managed-bean-class> > <managed-bean-scope>request</managed-bean-scope> > </managed-bean> > <managed-bean> > <managed-bean-name>carAction</managed-bean-name> > > <managed-bean-class>com.mycompany.CarAction</managed-bean-class> > <managed-bean-scope>request</managed-bean-scope> > <managed-property> > <property-name>carListBean</property-name> > <value>#{carListBean}</value> > </managed-property> > </managed-bean> > > (I'm calling your data bean carListBean, rather than carListAction, just > for my own clarity.) > > Then, as you point out, you'd have a dataTable entry like > > <h:dataTable value="#{carListBean.carModel}" var="car"> > <h:column> > <h:commandLink action="{carAction.getCar}"> > ... > <h:commandLink> > <h:column> > ... > </h:dataTable> > > Then, in your getCar() method, you'd have something like: > > public String getCar() { > Car selectedCar = (Car) > getCarListBean().getCarModel().getRowData(); > ... > } > > Hope that helps. > > - Brendan > > -----Original Message----- > From: Rick Reumann [mailto:[EMAIL PROTECTED] > Sent: Monday, August 29, 2005 4:02 PM > To: MyFaces Discussion > Subject: Re: Concerning DataModel usage plus overhead? > > > Actually, the MyFaces master/detail example source code is shedding > some light on some things. Rather than me waste more of your valuable > time, let me fart around with that code and see if I can tweak mine to > use a similar concept. Thanks for your help and patience so far. > > On 8/29/05, CONNER, BRENDAN (SBCSI) <[EMAIL PROTECTED]> wrote: > > Can you send a snippet of your faces-config.xml showing your managed > > bean definitions and your navigations, just to make sure I have the > > picture right? > > > > - Brendan > > > > -----Original Message----- > > From: Rick Reumann [mailto:[EMAIL PROTECTED] > > Sent: Monday, August 29, 2005 3:24 PM > > To: MyFaces Discussion > > Subject: Re: Concerning DataModel usage plus overhead? > > > > > > On 8/29/05, CONNER, BRENDAN (SBCSI) <[EMAIL PROTECTED]> wrote: > > > > > > I probably just got confused by your naming convention. Can you > > repeat your > > > question with clearer names? > > > > Sure. Let me change the names and concepts.. > > > > First page you come to is a list of cars on "cars.jsp". Cars is > > populated as DataModel from "CarsListAction.java" There is a managed > > bean reference for the name "cars" to "CarsListAction.java. > > CarsListAction has a method "getCars" which returns this DataModel. On > > cars.jsp you have... > > > > <h:dataTable var="car" value="#{carsListAction.cars}" > > > > > Another managed bean: CarAction.java has CRUD methods. In this case > > "getCar" which is supposed to get a "Car" back from the backend based > > on 'carID". > > > > I want to be able to click on car from the list on cars.jsp and hit > > the "getCar' method in my "CarAction.java" bean and forward to a > > carForm.jsp that lets me edit the car. If I use a DataModel with this > > I'm assuming I'll need to get a handle to the DataModel from my > > CarAction.java... but the DataModel was set up in CarsListAction. > > > > > -- > Rick > -- Rick

