关于托管的Java类名称约定在Primefaces中使用 [英] Java class name convention with respect to managed been usage in Primefaces

查看:240
本文介绍了关于托管的Java类名称约定在Primefaces中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse Indigo,每当我创建一个以小写字母开头的新类时,就会显示一条警告,如下所示(不鼓励使用类型名称。按照惯例,Java类型名称通常以大写字母开头)。 / p>



现在在我的xHTML / JSF文件中,如果我尝试以大写字母的第一个字母访问该类,则无法访问例如;



'#{MyClass.variableName}'不可访问,类构造函数也称为

'#{myClass.variableName}'工作正常。



注意:class有一个注释@ManagedBean



谢谢



这是编辑部分:
只有在使用第一个字母作为小写myClass创建类并且在JSF文件访问中使用相同的小写myClass

解决方案时才有效

为了遵循Java标准类名我使用了以下方法。

  @ManagedBean(name =myClass)
public class MyClass {

}

之前由于JSF行为,我正在使用

  @ManagedBean 
public class myClass {

}

请分享你在这种情况下所做的事情。



谢谢,



Asad


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

这篇关于关于托管的Java类名称约定在Primefaces中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆