第二次调用时未传递JSF参数
我在同一页上有两个按钮第二次调用时未传递JSF参数,jsf,Jsf,我在同一页上有两个按钮 <p:commandButton action="#{testController.create}" value="Next"> <f:param name="sid" value="#{sessionScope.userId}" /> </p:commandButton> <p:commandButton action="#{testController.update}" value="Next"> &l
<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>
我猜您得到的是
null指针
,因为您的param.get(“sid”)
为null。当用户登录时,我将id添加到userid中。这是一个数字,它实际上在第一次呼叫时起作用。示例我单击create。它给了我身份证没问题。但是,当我在单击“创建”之后单击“更新”时,它会显示错误。您使用的是哪个版本的JSF?您真的在运行您认为正在运行的代码吗?该错误表明您实际上有一个
,其中{}
中缺少
。
Map<String, String> param = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
int id = Integer.parseInt(param.get("sid"));
e = (java.lang.NumberFormatException) java.lang.NumberFormatException: For input string: "{sessionScope.userId}"