同じページに 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>
私のビーンでは、作成と更新の両方のメソッドに次のコードがあります。
Map<String, String> param = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
int id = Integer.parseInt(param.get("sid"));
更新または作成の最初のクリックで、param sid が機能します。しかし、2回目のクリックで、例外が発生しますint id = Integer.parseInt(param.get("sid"));
私は本当に混乱しています..ここで何が欠けていますか?
例外:
e = (java.lang.NumberFormatException) java.lang.NumberFormatException: For input string: "{sessionScope.userId}"