动作h:commandButton«无法找到匹配的导航案例»

时间:2012-12-12 21:59:56

标签: jsf-2

我有这些JSF文件:

索引implicit.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core">
<h:head>
    <title>Working with implicit and explicit conversion</title>
</h:head>
<h:body>
    <h:outputText value="Insert your age:"/><br />
    <h:form id="AgeForm">
        <h:inputText id="userAgeID" required="true" value="#{userBean.userAge}">
        </h:inputText>
        <h:message showSummary="true" showDetail="false" for="userAgeID"
                   style="color: red; text-decoration:overline"/>
        <br />
        <h:commandButton id="submit" action="response-implicit?faces-redirect=true" value="Submit Age"/>
    </h:form>
</h:body>

response-implicit.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>Working with implicit and explicit conversion</title>
</h:head>
<h:body>
    <h:outputText value="Inserted age: "/>
    <h:outputText value="#{userBean.userAge}"/>
</h:body>
</html>

接下来,我执行 index-implicit.xhtml ,输入Age,当我点击commandButton( Submit Age )时,此消息会出现两次:

Unable to find matching navigation case with from-view-id '/age-conversion/index-implicit.xhtml' for action 'response-implicit?faces-redirect=true' with outcome 'response-implicit?faces-redirect=true'

所以,我创建了另一个文件 response.xhtml (内容与 response-implicit.xhtml 相同),并更改了 操作= index-implicit.xhtml 中的“response?faces-redirect = true” ,它可以正常工作。

关于这个问题的一些想法?为什么请求适用于response.xhtml?

提前致谢!

P.S:

其他信息。:

  • 我已将PrimeFaces和ICEfaces包含在Web应用程序项目(NetBeans)中
  • 我正在使用GlassFish 3 App Server

0 个答案:

没有答案