FYI - I'm using Glassfish w/ the JSF 1.2 RI...but this should be a straightforward question regardless.
I have a page w/ a rather strange layout that I had previously written w/ a Servlet+JSP using RequestDispatcher...the old-skool MVC approach.
I'd now like to convert it to JSF since we're using that more these days but I'm having a tough time figuring out how it should be done.
The page is a list of employees, split into two columns. Each row has a radio button list to indicate the status of the employee (in regards to attendance) - i.e., the employee is either In, Out, or At Lunch. Next to that is a single text field for the employee to enter a note (e.g., will be out until next Monday, out sick, etc.)
We use this app at our front desk so visitors and employees can keep track of who's in and who is not. It's also used within our portal. Employees use it to set their own status and notes, if needed.
Now, the old way I had done this was; each row (employee) had its own form and I would auto-submit the individual form when one of the radio-buttons was clicked...and the logic to persist the status change was done in the doPost method of the servlet. I used a hidden field to track the employee ID (PK) for each row/form.
I'm really struggling with a simple way to do this in JSF. An h:form for each row, as was done w/ the old version, only renders one form control...and it only gets displayed for the last employee on the list. A global h:form throws an error since you can't have and id value repeated twice.
PS - I had to change "onclick" to "onclik" or I couldn't post, sorry for the previous message, the error I was getting was misleading.
Joined: Mar 18, 2004
Use single <h:form> before the start of the table and end it after table. However you will require a field "status" in your employee bean to hold the status against radio button. Its simple enough, i don't think there is any conplexity in converting this page into JSF.