我有一个带有某些表单,xhtml页面的JSF 2.0项目,添加了MyFaces Trinidad Input Date组件并运行了该应用程序后,当我单击Input Date图标时,它没有响应并且什么都不做?或者我得到这个错误:

在ExternalContext中找不到/_ADFv_.xhtml作为资源

我正在使用Eclipse Indigo 3.7.2,MyFaces Trinidad 2.0.1和JSF 2.0

我的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:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:tr="http://myfaces.apache.org/trinidad">
<h:body>
<h:form>
<ui:composition template="mainForm.xhtml">
    <ui:define name="content">

    <tr:panelBox>

    <tr:panelCaptionGroup captionText="Request:">
        <tr:panelFormLayout>
            <tr:inputDate id="RequestDate" label="Request Date:" >
                <f:convertDateTime dateStyle="short"/>
            </tr:inputDate>


            <tr:selectOneChoice id="RequestStatus" label="Request Status:" >
             <f:selectItem itemLabel="Enter Text"/>
             </tr:selectOneChoice>

             <tr:inputText id="Motivation" label="Motivation:" rows="5" columns="35"/>
        </tr:panelFormLayout>
    </tr:panelCaptionGroup>

    <tr:panelCaptionGroup captionText="Requestor:">
        <tr:panelFormLayout>
            <tr:selectOneRadio id="RadRequestor" layout="horizontal">
              <f:selectItem itemLabel="Employee" itemValue="Employee"/>
        <f:selectItem itemLabel="Committee" itemValue="Committee"/>
        <f:selectItem itemLabel="Group of Departments" itemValue="Group of Departments"/>
            </tr:selectOneRadio>

            <tr:selectOneChoice id="ComboRequestor">
             <f:selectItem itemLabel="Enter Text"/>
             </tr:selectOneChoice>

             <tr:inputText id="Contact" label="Contact Details:"/>

              <tr:inputText id="Contact1"/>

               <tr:inputText id="Contact2"/>

                <tr:inputText id="Contact3"/>

                 <tr:inputText id="Designation" label="Designation:"/>

                  <tr:inputText id="Department" label="Department:"/>
        </tr:panelFormLayout>
    </tr:panelCaptionGroup>

    <tr:panelCaptionGroup captionText="Request Details:">

            <tr:spacer height="15"/>
     <tr:selectOneChoice id="ComboRequestType" label="Request Type:">
             <f:selectItem itemLabel="Create/Update/Cancel/Deactivate"/>
             </tr:selectOneChoice>

             <tr:spacer height="20"/>

    <tr:panelTabbed position="above">
         <tr:showDetailItem text="Create">
         <tr:panelHeader text="Details of Change: Create Chart Field">

        <tr:panelFormLayout>
                    <tr:selectOneChoice id="ComboChart" label="Chart Segment:">
             <f:selectItem itemLabel="Chart Segment"/>
             </tr:selectOneChoice>
                    <tr:inputText id="ChartField" label="Chart Field:"/>
                    <tr:inputText id="Description" label="Description :"/>
                     <tr:selectOneChoice id="ComboAggregation" label="Aggregation Level :">
             <f:selectItem itemLabel="Aggregation Level"/>
             </tr:selectOneChoice>
                    <tr:inputText id="ParentField" label="Parent Field :"/>
                    <tr:selectOneChoice id="ComboPosting" label="Non-Posting/Posting Level:">
             <f:selectItem itemLabel="Non-Posting/Posting Level"/>
             </tr:selectOneChoice>
             <tr:selectOneChoice id="ComboAccount" label="Account Type:">
             <f:selectItem itemLabel="Account Type"/>
             </tr:selectOneChoice>
              <tr:selectOneChoice id="ComboBreakdown" label="Breakdown Allowed:">
             <f:selectItem itemLabel="Yes/No"/>
             </tr:selectOneChoice>
             <tr:inputText id="ParentClearing" label="Clearing Account Indicator:"/>
             <tr:inputText id="Motivation2" label="Motivation:" rows="5" columns="35" value="Motivation"/>
             <tr:inputDate id="RequestDate" label="Effective Date:">
                <f:convertDateTime dateStyle="short"/>
                    </tr:inputDate>
                </tr:panelFormLayout>
        </tr:panelHeader>
        </tr:showDetailItem>

         <tr:showDetailItem text="Change">
         <tr:panelHeader text="Details of Change: Activate/Deactivate Chart Field">
         <tr:commandButton text="Select"/>

        <tr:panelFormLayout>
                    <tr:inputText id="ChartSegment" label="Chart Segment:"/>
                    <tr:inputText id="ChartField2" label="Chart Field:"/>
                    <tr:inputText id="Description2" label="Description:"/>
                     <tr:selectOneChoice id="ComboAction" label="Action:">
             <f:selectItem itemLabel="Activate/Deactivate"/>
             </tr:selectOneChoice>
             <tr:inputText id="Motivation3" label="Motivation:" rows="5" columns="35" value="Motivation"/>
             <tr:inputDate id="EffectiveDate" label="Effective Date:">
                <f:convertDateTime dateStyle="short"/>
                    </tr:inputDate>
                </tr:panelFormLayout>
        </tr:panelHeader>
        </tr:showDetailItem>

         <tr:showDetailItem text="Update">
         <tr:panelHeader text="Details of Change: Update Chart Field">
         <tr:commandButton text="Select"/>

        <tr:panelFormLayout>
                    <tr:inputText id="ChangeDesc" label="Description of Change:" value="Necessary ?"/>
                    <tr:inputText id="Chartseg" label="Chart Segment:"/>
                    <tr:inputText id="ChartField3" label="Chart Field:"/>
                    <tr:inputText id="Description3" label="Description:"/>
                    <tr:inputText id="ParentField" label="Parent Field:"/>
                    <tr:spacer height="10" />
                    <tr:inputText id="NewFieldName" label="New Field Name:"/>
                    <tr:inputText id="NewDescription" label="New Description :"/>
                    <tr:panelHorizontalLayout halign="left">
                    <tr:commandButton text="Select"/>
                    <tr:inputText id="NewParentField" label="New Parent Field:"/>
                    </tr:panelHorizontalLayout>
             <tr:inputText id="Motivation4" label="Motivation:" rows="5" columns="35" value="Motivation"/>
             <tr:inputDate id="EffectiveDate2" label="Effective Date:">
                <f:convertDateTime dateStyle="short"/>
                    </tr:inputDate>
                </tr:panelFormLayout>
        </tr:panelHeader>
        </tr:showDetailItem>

         <tr:showDetailItem text="Cancel">
         <tr:panelHeader text="Details of Change: Cancel Chart Field">
         <tr:commandButton text="Select"/>

        <tr:panelFormLayout>
                    <tr:inputText id="Chartseg2" label="Chart Segment:"/>
                    <tr:inputText id="ChartField4" label="Chart Field:"/>
                    <tr:inputText id="Description4" label="Description:"/>
                    <tr:spacer height="20" />
             <tr:inputText id="Motivation5" label="Motivation:" rows="5" columns="35" value="Motivation"/>
             <tr:inputDate id="EffectiveDate3" label="Effective Date:">
                <f:convertDateTime dateStyle="short"/>
                    </tr:inputDate>
                </tr:panelFormLayout>
        </tr:panelHeader>
        </tr:showDetailItem>

        </tr:panelTabbed>



    </tr:panelCaptionGroup>

    <tr:spacer height="20"/>

    <tr:panelButtonBar halign="center">
        <tr:commandButton text="Cancel"/>
        <tr:commandButton text="Submit"/>
        <tr:commandButton text="Save"/>
    </tr:panelButtonBar>

    </tr:panelBox>

    </ui:define>

</ui:composition>
</h:form>
</h:body>
</html>

最佳答案

我仍然找到解决方案,但是如果您替换此解决方案,则在web.xml中是一种解决方案:

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


与:

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>`


它似乎工作正常。

关于java - 如何使用MyFaces Trinidad输入日期组件?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11078718/

10-12 22:55