This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The value is "deviceList" which is a List full of Device Objects. So this can display anywhere from 0-10 devices.
I need to be able to edit any or all of the inputText fields to change the device.name value. I'm really not sure how to do this though.
Here is how I would do so if there were only one device, and if I were not using a4j:repeat tag.
Here would be the jsf page:
Much easier to edit in the java code, because it is binding that device name to an actual variable in my updateAllBean. But in the first bit of code I am binding that to one of the values in the deviceList List that is a variable in the updateAllBean. So essentially I am trying to edit Objects in a List rather than individual variables.
Here is what the java code would look like if I used this second version of the jsf page:
But that above java code is not going to work when I change my jsf page to the a4j:repeat (which is what must be done so all devices are displayed, not just one device)
In that java code, lines 5 and 23 are going to be the problem. Line 5 refers to the deviceName variable and line 23 refers to the deviceId variable. However, in the a4j version of this page, those two variables do not exist, except indirectly. They exist in the Device class, and there is a List of Device Objects, but Im not sure how to make this work.
So lets say the first jsf code from above returns a page with two devices, like this:
Device Name: Device Name 1
Device Name: Device Name 2
The underlined fields represent inputText fields that can be edited. So let's say I want to change the name on device 1, but not device 2. I would re type the first text field to whatever name I want to change it to, but how am I going to let my java code know which one Im trying to change? Will it just know which device I am trying to change by which text field I edit?
Any tips would be great, I'm a bit lost on how to do this.
True wisdom is in knowing you know nothing - Socrates