简体   繁体   English

@Inject属性在JSF页面上显示为“未知属性”

[英]@Inject property showing as “unknown property” on JSF page

I am working on a Java EE project. 我正在从事Java EE项目。 I have a bean which is using @Inject on another bean. 我有一个在另一个bean上使用@Inject的bean。 For example: 例如:

@Inject
VendorBean vendor;

The bean with this code inside is called poGeneratorBean. 包含此代码的bean被称为poGeneratorBean。 In my JSF I am trying to call poGeneratorBean.vendor.x, however it is saying that vendor is an unknown property. 在我的JSF中,我试图调用poGeneratorBean.vendor.x,但是这表明供应商是未知属性。 I have tried putting public in front of "VendorBean vendor;" 我尝试将公众放在“ VendorBean供应商”的前面; but that didn't do anything either. 但这也不起作用。

Sorry this question might be a little vague, I am trying my best to explain the situation. 抱歉,这个问题可能有点含糊,我正在尽力解释情况。 Basically I am trying to display properties from VendorBean, using the poGeneratorBean via the @Inject, onto my JSF page. 基本上,我试图通过@Inject使用poGeneratorBean将VendorBean的属性显示到我的JSF页面上。

You need to have a public getter for it, conform the Javabeans specification . 您需要为此提供一个公共获取器,并遵循Javabeans规范

public VendorBean getVendor() {
    return vendor;
}

EL namely works as per the Javabeans specification. EL即按照Javabeans规范工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM