This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Sorry if I have missed a similar post before (I searched, and didn't find one)...I'm looking for advice on applying best practices towards JSF page design.
We're building an application using JBoss Seam along with JSF + IceFaces; we seem to be adding more JSF pages than we can keep track of. Each entity/object is handled by at least four JSF pages: 1) a page to view the object (ex. "viewProfile.xhtml") 2) a page to modify the object (ex. "modifyProfile.xhtml") 3) a page to create the object (ex. "createProfile.xhtml") 4) a page to confirm either the creation and/or modification of the object (ex. "confirmProfile.xhtml")
As you can see, with an application to be composed of at least 300 entities, this will quickly get out of control.
What we feel would provide not only a more streamlined user experience, but also reduce headaches for our developers and save time, would be to reuse no more than two of the JSF pages (above) to accomplish the entire CRUD spectrum. We know we can manually go through the page DOM and enable/disable form elements - but what I would really like to know is if there is a better way?
So, instead of the above, we would have: 1) "createProfile.xhtml" 2) "viewOrModify.xhtml"
I don't wish to get into the heavy weeds of handling form elements via the DOM; does anyone have any recommendations on how we should proceed?
Wouldn't those pages basically look the same and just have a "mode" different. And that "mode" value could be in a Seam object outjected. Then you can use that in an attribute of the fields to either have it editable or not.
But also since you are using xhtml, why not create the page as a template? Or you can even go codewise an generate the page from code where it reads the fields of the domain objects and creates an crud page for those objects. Or you can also go the route of using seamgen to generate the crud pages for you for all those domain objects.
There are lots of choices out there to go that will save you from writing 1200 different pages.