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 Naming Conventions for XHTML and BackingBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Naming Conventions for XHTML and BackingBeans" Watch "Naming Conventions for XHTML and BackingBeans" New topic
Author

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?

Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

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.


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: Naming Conventions for XHTML and BackingBeans