JSF参数未在第二次调用时传递

时间:2013-03-12 05:20:08

标签: jsf

我在同一页面上有2个按钮。

<p:commandButton action="#{testController.create}" value="Next">
    <f:param name="sid" value="#{sessionScope.userId}" />
</p:commandButton>

<p:commandButton action="#{testController.update}" value="Next">
    <f:param name="sid" value="#{sessionScope.userId}" />
</p:commandButton>

在我的bean上,create和update方法都有这个代码:

Map<String, String> param = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
int id = Integer.parseInt(param.get("sid"));

第一次点击更新或创建,让param sid工作。但是在第二次点击时,它会在int id = Integer.parseInt(param.get("sid"));

上给我一个例外

我真的很困惑..我在这里失踪了什么?

异常:

e = (java.lang.NumberFormatException) java.lang.NumberFormatException: For input string: "{sessionScope.userId}"

0 个答案:

没有答案
相关问题