I am using Eclipse Indigo and whenever I create a new class starting with lower case then a warning is shown as displayed below (" Type name is discouraged. By convention, Java type names usually start with an uppercase letter").

Now in my xHTML / JSF file, if i try to access the class with first letter in caps then it is not accessible e-g;
'#{MyClass.variableName}' is NOT accessible nor the class constructor is called whereas '#{myClass.variableName}' works fine.
Note: class has an annotation "@ManagedBean"
Thanks
This is edited part: It only works if class is created with first letter as lower case "myClass" and in JSF file access with the same lower case "myClass"
In order to follow the Java standard for class name I have used the following approach.
@ManagedBean(name="myClass")
public class MyClass {
}
previously due to JSF behaviour, I was using
@ManagedBean
public class myClass {
}
Please also share that what you do in such cases.
Thanks,
Asad
Its the expected behavior
By default, the name associated with a bean is simply the lowercase form of its class name
You give your class a name with Capitalized Letter , like MyClass
and accessing it from your xhtmls like this #{myClass.someVariable}
(with a lower case prefix)
its not related to Primefaces , its the general approach in JSF
来源:https://stackoverflow.com/questions/12297006/java-class-name-convention-with-respect-to-managed-been-usage-in-primefaces