aspose file tools*
The moose likes JSF and the fly likes Enabling CRUD from a single JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Enabling CRUD from a single JSF" Watch "Enabling CRUD from a single JSF" New topic
Author

Enabling CRUD from a single JSF

Chris Simons
Greenhorn

Joined: Aug 29, 2007
Posts: 19
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?

I appreciate it!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

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.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enabling CRUD from a single JSF