Primefaces import enum all 选项不适用于 JSF PROJECT_STAGE 设置为 Production

问题描述 投票:0回答:1

我有一个 Java EE Web 项目,我在其中使用 Primefaces 作为 UI 组件。我正在使用 Primefaces 提供的带有全后缀的导入枚举功能。当我的 JSF PROJECT_STAGE 设置为 Development 时,一切正常。当我将其更改为生产时,出现以下异常

javax.faces.FacesException: Class org.myorg.myEnum does not contain the enum ALL_OPTS
    at org.primefaces.component.importenum.EnumHashMap.get(EnumHashMap.java:49)
    at java.base/java.util.Collections$UnmodifiableMap.get(Collections.java:1454)
    at javax.el.MapELResolver.getValue(MapELResolver.java:148)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:156)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:184)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:114)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:177)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
    at org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:170)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:157)
    at javax.faces.component.UISelectItems.getValue(UISelectItems.java:108)
    at org.primefaces.renderkit.SelectRenderer.getSelectItems(SelectRenderer.java:91)
    at org.primefaces.component.selectoneradio.SelectOneRadioRenderer.encodeTabularLayout(SelectOneRadioRenderer.java:172)
    at org.primefaces.component.selectoneradio.SelectOneRadioRenderer.encodeMarkup(SelectOneRadioRenderer.java:93)
    at org.primefaces.component.selectoneradio.SelectOneRadioRenderer.encodeEnd(SelectOneRadioRenderer.java:63)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:67)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeMarkup(OutputPanelRenderer.java:92)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:60)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:67)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeMarkup(OutputPanelRenderer.java:92)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:60)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeDynamicBody(PanelGridRenderer.java:165)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableBody(PanelGridRenderer.java:127)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableLayout(PanelGridRenderer.java:82)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeEnd(PanelGridRenderer.java:53)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
    at org.primefaces.component.tabview.TabViewRenderer.encodeTabContent(TabViewRenderer.java:308)
    at org.primefaces.component.tabview.TabViewRenderer.lambda$encodeContents$1(TabViewRenderer.java:279)
    at org.primefaces.component.tabview.TabView.forEachTab(TabView.java:188)
    at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:277)
    at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:154)
    at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:92)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
    at org.primefaces.component.tabview.TabViewRenderer.encodeTabContent(TabViewRenderer.java:303)
    at org.primefaces.component.tabview.TabViewRenderer.lambda$encodeContents$1(TabViewRenderer.java:279)
    at org.primefaces.component.tabview.TabView.forEachTab(TabView.java:188)
    at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:277)
    at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:154)
    at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:92)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
    at org.primefaces.component.tabview.TabViewRenderer.encodeTabContent(TabViewRenderer.java:303)
    at org.primefaces.component.tabview.TabViewRenderer.lambda$encodeContents$1(TabViewRenderer.java:279)
    at org.primefaces.component.tabview.TabView.forEachTab(TabView.java:188)
    at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:277)
    at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:154)
    at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:92)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:67)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeMarkup(OutputPanelRenderer.java:92)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:60)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:67)
    at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:219)
    at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:132)
    at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:68)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
    at org.primefaces.component.tabview.TabViewRenderer.encodeTabContent(TabViewRenderer.java:303)
    at org.primefaces.component.tabview.TabViewRenderer.lambda$encodeContents$1(TabViewRenderer.java:279)
    at org.primefaces.component.tabview.TabView.forEachTab(TabView.java:188)
    at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:277)
    at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:154)
    at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:92)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:67)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeMarkup(OutputPanelRenderer.java:92)
    at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:60)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:152)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1647)
    at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:615)
    at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:159)
    at javax.faces.component.UIForm.visitTree(UIForm.java:365)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIForm.visitTree(UIForm.java:355)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at org.primefaces.component.api.UITabPanel.visitTree(UITabPanel.java:908)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
    at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:400)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:319)
    at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:65)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:228)
    at org.omnifaces.context.OmniPartialViewContext.processPartial(OmniPartialViewContext.java:122)
    at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1102)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1647)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:442)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
    at org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:151)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
    at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1636)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:331)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
    at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:282)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
    at in.gov.issdc.pps.ui.filters.CustomHTTPHeadersFilter.doFilter(CustomHTTPHeadersFilter.java:124)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
    at in.gov.issdc.idp.api.PostLoginFilter.doFilter(PostLoginFilter.java:69)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
    at org.keycloak.adapters.servlet.KeycloakOIDCFilter.doFilter(KeycloakOIDCFilter.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
    at in.gov.issdc.idp.api.PreLoginFilter.doFilter(PreLoginFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:757)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:577)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:757)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:577)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:368)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
    at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:200)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
    at java.base/java.lang.Thread.run(Thread.java:834)

我的网页分数如下

            <p:importEnum type="org.myEnum" var="opt" allSuffix="ALL_OPTS"/>
            <p:outputPanel style="display:flex;">
                <p:selectOneRadio id="one-radio"  
                                  value="#{myView.option}" 
                                  >
                    <f:selectItems value="#{opt.ALL_OPTS}" var="ui_opt"
                                   itemLabel="#{ui_opt.displayName}"
                                   itemValue="#{ui_opt}" itemLabelEscaped="false"/>
                </p:selectOneRadio>
            </p:outputPanel>

我认为这可能是一个错误,但是当我尝试在一个独立的示例项目中使用这个 Web 部分并将项目阶段设置为生产的一个页面时,它可以工作。我现在很困惑。

以下是项目详情

Java, JDK 11.0.8
Payara 5.2020.4
Primefaces 11.0

这是依赖项 -


SparseBitSet-1.2.jar
apache-mime4j-0.6.jar
barcodes-7.2.3.jar
bcpkix-jdk15on-1.68.jar
bcprov-jdk15on-1.68.jar
btf-1.2.jar
checker-qual-2.8.1.jar
commons-7.2.3.jar
commons-codec-1.11.jar
commons-codec-1.13.jar
commons-codec-1.15.jar
commons-collections4-4.4.jar
commons-compress-1.21.jar
commons-io-2.11.0.jar
commons-io-2.5.jar
commons-logging-1.2.jar
commons-math3-3.6.1.jar
curvesapi-1.06.jar
eclipselink_3.0.2.jar
failureaccess-1.0.1.jar
font-asian-7.2.3.jar
forms-7.2.3.jar
guava-28.1-jre.jar
hazelcast.jar
html2pdf-4.0.3.jar
httpclient-4.5.12.jar
httpclient-4.5.13.jar
httpcore-4.4.13.jar
hyph-7.2.3.jar
io-7.2.3.jar
istack-commons-runtime-3.0.10.jar
itextpdf-5.5.6.jar
jackson-annotations-2.10.5.jar
jackson-annotations-2.12.1.jar
jackson-annotations-2.12.6.jar
jackson-core-2.10.5.jar
jackson-core-2.12.1.jar
jackson-coreutils-1.6.jar
jackson-databind-2.10.5.jar
jackson-databind-2.12.6.1.jar
jackson-jaxrs-base-2.10.5.jar
jackson-jaxrs-json-provider-2.10.5.jar
jackson-module-jaxb-annotations-2.10.5.jar
jakarta.activation-1.2.1.jar
jakarta.activation-1.2.2.jar
jakarta.activation-api-1.2.1.jar
jakarta.jakartaee-api-8.0.0.jar
jakarta.mail-1.6.5.jar
jakarta.validation-api-2.0.2.jar
javax.faces.jar
jaxb-runtime-2.3.3-b02.jar
jboss-annotations-api_1.3_spec-2.0.1.Final.jar
jboss-jaxb-api_2.3_spec-2.0.0.Final.jar
jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar
jboss-logging-3.3.2.Final.jar
jboss-logging-3.4.1.Final.jar
jcip-annotations-1.0-1.jar
json-patch-1.9.jar
json-smart-2.3.jar
jsr305-2.0.0.jar
jsr305-3.0.2.jar
juniversalchardet-2.4.0.jar
kernel-7.2.3.jar
keycloak-adapter-core-18.0.2.jar
keycloak-adapter-spi-18.0.2.jar
keycloak-admin-client-18.0.2.jar
keycloak-authz-client-18.0.2.jar
keycloak-common-18.0.2.jar
keycloak-core-18.0.2.jar
keycloak-servlet-adapter-spi-18.0.2.jar
keycloak-servlet-filter-adapter-18.0.2.jar
layout-7.2.3.jar
listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
log4j-api-2.14.1.jar
log4j-core-2.14.1.jar
mime-types-1.0.1.jar
mime-types-master.zip
msg-simple-1.1.jar
nimbus-jose-jwt-9.7.jar
openpdf-1.3.30.jar
owasp-java-encoder-web_1.2.3.jar
owasp-java-html-sanitizer-20180219.1.jar
pdfa-7.2.3.jar
pdftest-7.2.3.jar
poi-5.1.0.jar
poi-examples-5.1.0.jar
poi-ooxml-5.1.0.jar
poi-ooxml-lite-5.1.0.jar
poi-scratchpad-5.1.0.jar
primefaces-11.0.0.jar
primefaces-extensions-11.0.0-RC1.jar
reactive-streams-1.0.3.jar
resteasy-client-3.13.2.Final.jar
resteasy-jackson2-provider-3.13.2.Final.jar
resteasy-jaxb-provider-3.13.2.Final.jar
resteasy-jaxrs-3.13.2.Final.jar
resteasy-multipart-provider-3.13.2.Final.jar
security-connector-oauth2-client-2.7.0.jar
sign-7.2.3.jar
slf4j-api-2.0.2.jar
styled-xml-parser-7.2.3.jar
svg-7.2.3.jar
txw2-2.3.3-b02.jar
xmlbeans-5.0.2.jar
omnifaces-3.14.6.jar

下面是我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <!-- JSF related-->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>saga</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.FONT_AWESOME</param-name>
        <param-value>true</param-value>
    </context-param>


       <context-param>
        <param-name>javax.faces.FACELETS_BUFFER_SIZE</param-name>
        <param-value>50000000</param-value>
    </context-param>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- Faces Servlet-->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>home.xhtml</welcome-file>
    </welcome-file-list>
    <!-- general error page -->
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/expired.xhtml</location>
    </error-page>
    <error-page>
        <location>/error.xhtml</location>
    </error-page>

    <!-- mime type mpping -->
    <mime-mapping>
        <extension>ttf</extension>
        <mime-type>application/font-sfnt</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff</extension>
        <mime-type>application/font-woff</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff2</extension>
        <mime-type>application/font-woff2</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>eot</extension>
        <mime-type>application/vnd.ms-fontobject</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>eot?#iefix</extension>
        <mime-type>application/vnd.ms-fontobject</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>svg</extension>
        <mime-type>image/svg+xml</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>svg#exosemibold</extension>
        <mime-type>image/svg+xml</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>svg#exobolditalic</extension>
        <mime-type>image/svg+xml</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>svg#exomedium</extension>
        <mime-type>image/svg+xml</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>svg#exoregular</extension>
        <mime-type>image/svg+xml</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>svg#fontawesomeregular</extension>
        <mime-type>image/svg+xml</mime-type>
    </mime-mapping>
   

</web-app>

java jsf primefaces
1个回答
0
投票

Import Enum 有一个定义“allSuffix”的选项。我将其定义为自定义字符串。当我删除它并使用默认的 ALL_VALUES 时,生产 PROJECT_STAGE 中一切正常。

我不知道为什么,但它有效。我需要挖掘更多才能理解。

下面是抛出异常之前的片段 -

            <p:importEnum type="org.myEnum" var="opt" allSuffix="ALL_OPTS"/>
            <p:outputPanel style="display:flex;">
                <p:selectOneRadio id="one-radio"  
                                  value="#{myView.option}" 
                                  >
                    <f:selectItems value="#{opt.ALL_OPTS}" var="ui_opt"
                                   itemLabel="#{ui_opt.displayName}"
                                   itemValue="#{ui_opt}" itemLabelEscaped="false"/>
                </p:selectOneRadio>
            </p:outputPanel>

以下是工作片段--

            <p:importEnum type="org.myEnum" var="opt"/>
            <p:outputPanel style="display:flex;">
                <p:selectOneRadio id="one-radio"  
                                  value="#{myView.option}" 
                                  >
                    <f:selectItems value="#{opt.ALL_VALUES}" var="ui_opt"
                                   itemLabel="#{ui_opt.displayName}"
                                   itemValue="#{ui_opt}" itemLabelEscaped="false"/>
                </p:selectOneRadio>
            </p:outputPanel>

**注意,

allSuffix
未定义,内置名称
ALL_VALUES
用于引用
f:selectItems
中的所有枚举值。 **

© www.soinside.com 2019 - 2024. All rights reserved.