【发布时间】:2012-01-23 05:38:21
【问题描述】:
我的问题是bean中参数的值为null
在 xhtml 中我有这个代码:
<h:commandLink action="#{navigation.editNews}" value="#{new.title}">
<f:param name="newsId" value="#{new.id}" />
</h:commandLink>
在导航中我重定向到 news.xhtml
public String editNews(){
return "editNews";
}
这是 faces-config.xml 中的代码
<navigation-case>
<from-action>#{navigation.editNews}</from-action>
<from-outcome>editNews</from-outcome>
<to-view-id>/news.xhtml</to-view-id>
<redirect />
</navigation-case>
我有一个 bean,当我在 news.xhtml 中按下按钮时调用方法并尝试获取参数但它为空
FacesContext fc = FacesContext.getCurrentInstance();
Map<String,String> params = fc.getExternalContext().getRequestParameterMap();
String = params.get("newsId");
【问题讨论】: