gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 05:16:44 24 4
gpt4 key购买 nike

我有一个带有一些表单、xhtml 页面的 JSF 2.0 项目,添加 MyFaces Trinidad 输入日期组件并运行该应用程序后,当我单击“输入日期”图标时,它没有响应并且不执行任何操作?或者我收到此错误:

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

我正在使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com