我在同一页面上有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}"