Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
第二次调用时未传递JSF参数_Jsf - Fatal编程技术网

第二次调用时未传递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}"