0

我有这些 JSF 文件:

索引隐式.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中更改了action="response?faces-redirect=true"并且它可以正常工作。

关于这个问题的一些想法?为什么 request 与 response.xhtml 一起工作?

提前致谢!

PS:

附加信息。:

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

0 回答 0