简体   繁体   中英

How to use MyFaces Trinidad Input Date component?

I have a JSF 2.0 project with some forms, xhtml pages, After adding the MyFaces Trinidad Input Date component and i run the application, when i click the Input Date icon, its non-responsive and doesn't do anything? or I get this error:

/_ ADFv _.xhtml Not Found in ExternalContext as a Resource

I'm using Eclipse Indigo 3.7.2, MyFaces Trinidad 2.0.1 and JSF 2.0

My xhtml Page:

<!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>

I am still find the solution but one solution is in web.xml if you replace this:

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

with:

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

it seems to be working fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM