File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes UI component centralized rendering control - best practices ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "UI component centralized rendering control - best practices ?" Watch "UI component centralized rendering control - best practices ?" New topic
Author

UI component centralized rendering control - best practices ?

Rod Berkley
Greenhorn

Joined: Oct 26, 2010
Posts: 1
We're using JSF 2.0 in our web layer, and we'd like to have a fine control over the UI components that need to be rendered and required.
Rather than applying "rendered" and "required" attributes on every component, we'd like to delegate such configurations to a centralized component.

There are several dimension to be considered on this configuration, such as the user logged in, the page being displayed, and some business contexts, i.e:
(page x, txtfield y, user A, business context w) -> ( rendererd = true, required = false)
(page x, txtfield y, user B, business context w) -> ( rendererd = true, required = true, error msg = ...)
(page x, txtfield y, user B, business context t) -> ( rendererd = false, required = false)

Is there some proven solution (a framework, maybe) to handle this requirement ?

Are there best practices to consider using JSF 2.0 API to handle this requirement ?

Regards,
Rod
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

Welcome to the JavaRanch, Ron!

Actually, centralized control doesn't work too well for me. I do better with components. For example, I'll often have a security component with a security context backing bean that I reference to obtain the logged-in user's name (if any) and to supply the render values for security-related constructs. This architecture is something I can recycle from app to app instead of having to create some sort of monolithic overstructure on a one-off basis per app.

I'm also using facelets augmented by custom facelet components for things like this. However, the main body of the page is typically a backing bean(s) specific to the functionality of that particular page. Which is why it's even more useful to have the invariant parts in their own function-specific components.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UI component centralized rendering control - best practices ?
 
Similar Threads
JTextField/JPanel with round edged corners
My own JSF component renders span after div when only div should be rendered. What's wrong?
Longer Post - ALL IBM ICE EXAM Q's for UML
JSF custom tag requirement
another 486 question -ugh!