Set project stage for JavaServer Faces with JNDI configuration/lookup in Glassfish v3

六眼飞鱼酱① 提交于 2020-01-02 07:08:32

问题


I'm trying to set the project stage for JavaServer Faces in a GlassFish application server v3 with a JNDI property.

I set the stage property to Development stage, but my application received always the Production stage.

I use GlassFish Server Open Source Edition 3.1 (build 43) on a windows system.

For rendering the project stage in the JSF page I use this:

<h:outputText value="Stage:#{facesContext.application.projectStage}"/>

Is anything else necessary to use the project stage in an application? The application has no web.xml file.


回答1:


Everything is correct, but instead of stage=Development, use value = Development, i.e. replace stage with value in the property name field.




回答2:


You need this in your web.xml. It works with 'stage' then.

<resource-ref>
        <res-ref-name>jsf/ProjectStage</res-ref-name>
        <res-type>java.lang.String</res-type>
        <mapped-name>javax.faces.PROJECT_STAGE</mapped-name>
</resource-ref>

This maps the global JNDI property of GF to the reference lookup in JSF.



来源:https://stackoverflow.com/questions/8491904/set-project-stage-for-javaserver-faces-with-jndi-configuration-lookup-in-glassfi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!