File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Naming Conventions for XHTML and BackingBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Naming Conventions for XHTML and BackingBeans" Watch "Naming Conventions for XHTML and BackingBeans" New topic

Naming Conventions for XHTML and BackingBeans

Luke Murphy
Ranch Hand

Joined: May 12, 2010
Posts: 300
Are there any naming conventions for .xhtml files and for backing beans?

For example, should a .xhtml file being with lower or upper case?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

I prefer camel-case for the xhtml filenames myself, but if there's an actual recommended standard, I missed seeing it.

Backing beans are another matter entirely. If you use JSF2 annotations, the default name applied to the bean will be the bean's classname with the first character lowercased. Beginning a bean name with an upper-case letter is inadvisable, because only Classes should do that, not Instances, per standard Java conventions.

I normally like to suffix my bean classnames with "BackingBean". It's a bit redundant, since they're usually already located under a "backingbean" package level, but it does ensure that you don't end up with things like "com.x.backing.MyBean", "com.x.persistence.model.MyBean", "com.x.utils.jsf.validator.MyBean" and end up all confused when you see the simple name without knowing the exact context.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Naming Conventions for XHTML and BackingBeans
It's not a secret anymore!