如何访问JSF中超级接口定义的方法?
我尝试通过 NetBeans 7 实现托管 bean 来学习 JSF 2.0。总的来说,它包含作为数据对象的属性,该数据对象实现如下接口: -
public interface MyInterface1 {
void setName(String name);
String getName();
}
public interface MyInterface2 extends MyInterface1 {
void setPhone(String phone);
String getPhone();
}
public class MyInfo implements MyInterface2 {
//...Getter, Setter
}
@ManagedBean(name="myBean")
public class MyManagedBean {
private MyInfo myInfo = new MyInfo();
//..Getter, Setter
}
当我在 JSF/XHTML 中输入 EL
#{myBean.myInfo....}
作为超级接口中定义的方法,MyInterface1 不会显示。 我不确定这是否是工具限制,或者我可能做错了什么。
您能帮忙进一步指教吗?非常感谢您提前提供的帮助。我期待尽快收到您的来信。
问候,
查理 Ch.
I've tried to learn the JSF 2.0 by implementing the managed bean via the NetBeans 7. By overview it contains the property as a data object which implements the interface as the following: -
public interface MyInterface1 {
void setName(String name);
String getName();
}
public interface MyInterface2 extends MyInterface1 {
void setPhone(String phone);
String getPhone();
}
public class MyInfo implements MyInterface2 {
//...Getter, Setter
}
@ManagedBean(name="myBean")
public class MyManagedBean {
private MyInfo myInfo = new MyInfo();
//..Getter, Setter
}
When I enter the EL at the JSF/XHTML as
#{myBean.myInfo....}
the methods which are defined at the Super Interface, the MyInterface1 is not displayed.
I'm not sure if it is a tool limitation or I may do something wrong or not.
Could you please help to advise further? Thank you very much for your help in advance. I'm looking forward to hearing from you soon.
Regards,
Charlee Ch.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这绝对是 Netbeans 编辑器的限制。我一直在 NB 6.9 中遇到类似的问题,代码完成有时根本不起作用,有时会丢失接口/方法等。但是,嘿,您可以继续自己输入方法名称 - 它应该可以工作。
This is definitely a limitation of the Netbeans editor. I've constantly struggled with similar issues in NB 6.9, code completion would sometimes not work at all, sometimes missing out interfaces/methods, etc. But hey, you can go ahead and type in the method name yourself - it should work.