如何使用MyFaces Trinidad输入日期组件?

时间:2012-06-18 07:43:56

标签: java java-ee jsf-2 myfaces trinidad

我有一个JSF 2.0项目,包含一些表格,xhtml页面,在添加MyFaces Trinidad输入日期组件后,我运行应用程序,当我点击输入日期图标时,它没有响应,并没有做任何事情?或者我收到此错误:

/ _ ADFv _。在ExternalContext中找不到作为资源的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>

1 个答案:

答案 0 :(得分:0)

我仍然可以找到解决方案但是如果你替换它,一个解决方案就在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>`
它看起来工作正常。