Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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 必须按p:commandButton两次(非移动)_Jsf_Primefaces - Fatal编程技术网

Jsf 必须按p:commandButton两次(非移动)

Jsf 必须按p:commandButton两次(非移动),jsf,primefaces,Jsf,Primefaces,我已经将一个在JSF1.2上运行的应用程序升级到了2.1,现在命令按钮出现了问题。 我已经检查了我能找到的关于这个主题的所有其他帖子,但没有一篇是在相同的情况下发表的 我使用javax.faces-2.1.11、myfaces-api-2.1.9、myfaces-impl-2.1.9和primefaces-3.2运行Tomcat 6.0 我有一个h:form,它包含 <p:commandButton action="#{invoiceController.newInvoice}" valu

我已经将一个在JSF1.2上运行的应用程序升级到了2.1,现在命令按钮出现了问题。 我已经检查了我能找到的关于这个主题的所有其他帖子,但没有一篇是在相同的情况下发表的 我使用javax.faces-2.1.11、myfaces-api-2.1.9、myfaces-impl-2.1.9和primefaces-3.2运行Tomcat 6.0

我有一个h:form,它包含

<p:commandButton action="#{invoiceController.newInvoice}" value="New Invoice" >
</p:commandButton>

newInvoice方法包含

public String newInvoice() {
    detailInvoice = new Invoice();
    detailInvoice.setLines(new ArrayList<InvoiceLine>());
    detailInvoice.setInvoiceNo("new");
    detailLine = new InvoiceLine();
    lines = new ArrayList<InvoiceLine>();
    return "invoicedetail";
}
公共字符串newInvoice(){
detailInvoice=新发票();
detailInvoice.setLines(new ArrayList());
详细发票。设置发票编号(“新”);
detailLine=新发票行();
行=新的ArrayList();
返回“发票明细”;
}
invoicedetails.xhtml存在于同一文件夹中

这会呈现一个按钮,当我第一次按下它时,什么都不会发生,当我第二次按下它时,会显示invoicedetails.xhtml

我尝试添加ajax=“false”,但无论按钮按下多少次,都不会发生任何事情


这是如此基本的一件事,我肯定错过了什么,但却找不到它是什么。感谢您的帮助

如果是请求范围,请将其更改为查看范围谢谢Daniel,我会尝试一下