我有 selectOneMenu
<h:selectOneMenu id = "current" value = "#{helloBean.currentLanguage}">
<f:selectItems value="#{helloBean.categoryLanguages}"></f:selectItems>
<f:ajax render = "ccData"></f:ajax>
</h:selectOneMenu>
这是HelloBean
@ManagedBean(name="helloBean")
@SessionScoped
public class HelloBean implements Serializable {
private String currentLanguage;
public void setcurrentLanguage(String currentLanguage){
this.currentLanguage = currentLanguage;
}
}
我在设置 currentLanguage 时遇到问题。Eclipse 显示一条错误消息,即#{helloBean.currentLanguage}
表达式不可设置。当我运行我的项目时,我得到一个错误
javax.servlet.ServletException: /hello.xhtml @19,74 value="#{helloBean.currentLanguage}": Property 'currentLanguage' not readable on type java.lang.String