找不到豆

时间:2018-12-30 00:15:00

标签: java-ee-7

我正在尝试学习JavaEE;在按照教程进行操作后,我无法到达已正确注释的Bean:

@Named("editPhotoBean")
@SessionScoped
public class EditPhoto implements Serializable `

使用jsf标签调用Bean方法:

`<h:inputFile 
    id="file" 
    value="#{editPhotoBean.uploadedPart}"> 
 <f:validator validatorId="imageUploadValidator" />
 </h:inputFile>`

我得到:

  

javax.el.PropertyNotFoundException:/upload.xhtml @ 30,63   value =“#{editPhotoBean.uploadedPart}”:无法到达目标,标识符   “ editPhotoBean”解析为空

以前我是这样的:

@Named(value = "editPhotoBean")

另一个可以说明的事实是,其他bean的属性显示为netbeans无法找到:

            <tr><td align='center'>
            <label>
                <c:if test="#{photoBook.currentPhoto.public}">
                    Everyone can see this photo
                </c:if>
                <c:if test="#{not photoBook.currentPhoto.public}">
                    Only you can see this photo
                </c:if>

            </label>
        </td></tr> 
        <tr><td align='center'>
                <label>Uploaded as #{photoBook.currentPhoto.filename}</label>

尽管该豆被标记为

@Named("photoBook")
@SessionScoped
 public class PhotoBook implements Serializable { 

我怀疑这与我的库有关,其他所有东西都起作用,但是我发现并意识到除了glassfish附带的东西外,我没有安装任何JAvaEE库:

enter image description here

有关要安装什么的任何提示? ||还有其他吗? 谢谢!

1 个答案:

答案 0 :(得分:-1)

  1. 如果使用JSF或PrimeFaces,请在页面顶部设置注释@ManagedBean 类别
  2. 列出uploadedPart属性上的设置项和获取项
相关问题