This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSF and the fly likes Dynamic components and best practice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamic components and best practice" Watch "Dynamic components and best practice" New topic
Author

Dynamic components and best practice

Stefan Ramirez
Greenhorn

Joined: Jul 10, 2011
Posts: 11
Hey Ranchers!

Once again I need your help...

I've bound several UIForms in my backing bean and am searching for a possibility to call them by name. Something like getComponent("bindingname");
Any hints on that?
Also for sequential access, I'd like to store those UIForms in a list? At my previous attempts I got NullPointerExceptions whenever I tried to call a form of the list.

If one wants to go for "best practice" would it be better to have very few xhtml pages? Hypothetical, one could implement a whole page in one xhtml file and progressive render the components right?

Thanks in advance,
Stefan
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

Best practice it to keep it simple. There will be occasion enough for complex solutions when a specific need arises, and if you're starting simple, there will be less likelihood of conflicts with existing constructs.

Simplest of all would be one View definition per webpage, but most of us are looking for a standard page layout for the bulk of the the website, so frequently these days we'll use Facelets templates to define the standard page and reference that layout for the specific page View definition.

Rule #1 in JSF is that any time you find yourself writing code that references anything in the javax.faces packages that isn't either a SelectItem or a DataTable model, you should stop and think. Because there's a good chance you're doing it wrong. JSF is designed to be POJO-based and a lot of effort went into ensuring that you WOULDN'T have a lot of platform-specific code and constructs littering up the place.


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: Dynamic components and best practice