Faces Servlet没有被调用特定页面,空白页面正在呈现?

时间:2012-03-07 19:44:33

标签: java jsf servlets jboss icefaces

我有icefaces申请,我在这里遇到的问题是facesServlet未从application.xhtml页面调用,但是当我从test.xhtml页面调用时,该页面呈现很好但是在application.xhtml的情况下,空白页面显示但是在查看源文件时你会看到该文件。

application.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"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component">
    <h:head>
        <title>Job Application</title>
        <ice:outputStyle href="./xmlhttp/css/xp/xp.css" />
    </h:head>
    <h:body>

    <ice:form partialSubmit="true">
        <ice:messages globalOnly="true" />

        <ice:panelGrid columns="3">
            <ice:outputLabel for="firstName" value="#{msgs.firstName}:" />
            <ice:inputText id="firstName" value="#{applicant.firstName}" required="true"/>
            <ice:message for="firstName" />

            <ice:outputLabel for="lastName" value="#{msgs.lastName}:" />
            <ice:inputText id="lastName" required="true" value="#{applicant.lastName}" />
            <ice:message for="lastName" />

            <ice:outputLabel for="travelPercentage" value="#{msgs.travelPercentage}:" />
            <ice:inputText id="travelPercentage" required="true" value="#{applicant.travelPercentage}">
                <f:validateLongRange minimum="0" maximum="100" />
            </ice:inputText>

            <ice:message for="travelPercentage" />

            <ice:outputLabel for="dateOfBirth" value="#{msgs.dateOfBirth}:" />
            <ice:selectInputDate id="dateOfBirth" required="true" value="#{applicant.dateOfBirth}"
                                     renderAsPopup="true">
                <f:convertDateTime pattern="MM/dd/yyyy" />
            </ice:selectInputDate>
            <ice:message for="dateOfBirth" />

            <ice:outputLabel for="city" value="#{msgs.city}" />
            <ice:inputText id="city" required="true" value="#{applicant.city}"/>
            <ice:message for="city" />

            <ice:outputLabel for="provinceId" value="#{msgs.provinceId}" />

                <ice:selectOneMenu id="provinceId"
                                 required="true"
                                 value="#{applicant.provinceId}">
                    <f:selectItem itemLabel="#{msgs.select}" itemValue="" />
                    <f:selectItems value="#{provinceSupport.selectItems}" />
                </ice:selectOneMenu>
            <ice:message for="provinceId" />

            <ice:outputLabel for="postalCode" value="#{msgs.postalCode}" />
            <ice:inputText id="postalCode"
                             required="true" value="#{applicant.postalCode}"/>
            <ice:message for="postalCode" />
        </ice:panelGrid>

        <ice:panelGrid columns="1">
            <ice:commandLink value="#{applicantForm.resumeRendered ? msgs.hideResume : msgs.showResume}"
                             actionListener="#{applicantForm.toggleResume}"
                             immediate="true"/>

            <ice:inputTextarea id="resume" value="#{applicant.resume}" cols="40" rows="8"
                               rendered="#{applicantForm.resumeRendered}"/>
        </ice:panelGrid>

        <ice:commandButton value="#{msgs.submitApplication}" action="#{applicantForm.submit}"
                           partialSubmit="false"/>
    </ice:form>

    </h:body>
</html>

test.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"
      xmlns:ice="http://www.icesoft.com/icefaces/component">
    <h:head><title>Thank You</title></h:head>
    <h:body>

    <ice:form>
        <ice:outputText value="Thank you #{applicant.firstName} for applying" />
        <br />
        <ice:commandButton action="submitAnother" value="Submit Another" />
    </ice:form>
     </h:body>
</html>

Servlet和Servlet映射信息:

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>Resource Servlet</servlet-name>
    <url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>

<servlet>
    <servlet-name>Resource Servlet</servlet-name>
    <servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

不确定是什么导致了这个问题,但当application.xhtml映射为facesServletfacesServlet也没有达到*.jsf那么我就无法同时使用*.xhtml页面但是如果我test.xhtml那么facesServlet页面会点击application.xhtml,但<?xml version="1.0" encoding="UTF-8"?>不会点击,不知道这里的问题是什么。

更新

我想,我不确定

test.xhtml,可能会导致问题,我的 <!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" xmlns:ice="http://www.icesoft.com/icefaces/component"> <h:head><title>Thank You</title></h:head> <h:body> <ice:form> <ice:outputText value="Thank you #{applicant.firstName} for applying" /> <br /> <ice:commandButton action="submitAnother" value="Submit Another" /> </ice:form> </h:body> </html> 页面如下:

browser

但是当我部署它并点击 <?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" xmlns:ice="http://www.icesoft.com/icefaces/component"> <h:head><title>Thank You</title></h:head> <h:body> <ice:form> <ice:outputText value="Thank you #{applicant.firstName} for applying" /> <br /> <ice:commandButton action="submitAnother" value="Submit Another" /> </ice:form> </h:body> </html> 上的那个页面时,没有任何显示,如果我点击查看源,那么我有

<?xml version="1.0" encoding="UTF-8"?>

我不确定web.xml是否可能导致问题,但是查看源代码放置了原始xhtml页面中不存在的xml标记,我也检查了部署在{x}标记中的facesServlet文件服务器,它确实已正确映射{{1}}我们也没有任何过滤器做一些疯狂的东西。

0 个答案:

没有答案