• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Need advice for converting this page to JSF

 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Here's what the OLD JSP looked like:



Thanks in advance! The help is appreciated!

-v

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.
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic