我正在尝试在我的 facelet 页面中调用getNebulizerModelName
在 a 的action
属性中调用的托管 bean 方法<h:commandLink>
,以便我可以根据 faces-config.xml 导航规则告诉隐式 NavigationHandler 下一步要去哪里。但我得到了上面描述的错误。方法就在那里,它符合标签库文档中规定的规则。值得注意的是,可以很好地找到并调用来自同一个托管 bean 的其他方法,如下面的代码所示。我已经搜索了大约一个小时的相关帖子。我尝试过清理、重新构建、重新启动服务器、关闭和打开 IDE。我在用:
- GlasshFish 4.1
- Java EE 7
- JSF 2.1
- 莫哈拉 2.3
- NetBeans 8.2
小脸页面:
<h:form>
<ul class="catGridList">
<ui:repeat value="#{productManager.nebulizers}" var="nebulizer">
<li class="catGridListItem">
<h:commandLink action="#{productManager.nebulizerModelName}">
<h:graphicImage class="catGridListImg" library="img" name="#{nebulizer.imageSrc}"/>
</h:commandLink>
</li>
</ui:repeat>
</ul>
</h:form>
托管 Bean 类:
@ManagedBean(name="productManager")
@SessionScoped
public class ProductManager implements Serializable {
private static final long serialVersionUID = 5874124596321L;
private final Logger logger = Logger.getLogger("xaris.web.ProductManager");
private List<Nebulizer> nebulizers;
private Nebulizer nebulizer;
private String nebulizerModelName;
@EJB
private RequestBean request;
public List<Nebulizer> getNebulizers() {
try {
this.nebulizers = request.getNebulizers();
}catch(Exception ex) {
logger.warning("Could not get nebulizers");
}
return nebulizers;
}
public String getNebulizerModelName() {
try {
nebulizerModelName = request.getNebulizerModelName();
} catch(Exception ex) {
ogger.warning("Could not get specific model name.");
}
switch(nebulizerModelName) {
case "Flo Eolo":
nebulizerModelName = "flo_eolo";
break;
case "Flo Miko":
nebulizerModelName = "flo_miko";
break;
default:
nebulizerModelName = "";
break;
}
return nebulizerModelName;
}
}
有什么建议么?