背景
托管 bean 必须通过其 web.xml 文件配置参数。web.xml 文件定义了在 JDeveloper (11.1.2.3) 中配置的上下文初始化参数,如下所示:
定义的来源reporting.server.protocol
如下:
<context-param>
<description>Defines the data transport mechanism to ret...</description>
<param-name>reporting.server.protocol</param-name>
<param-value>http</param-value>
</context-param>
bean 为reportServerProtocol
.
bean 的来源类似于:
@ManagedBean
@RequestScoped
public class OracleReportBean extends ReportBean {
@ManagedProperty("#{initParam['reporting.server.protocol']}")
private String reportServerProtocol = URLReportImpl.DEFAULT_PROTOCOL;
// ...
}
问题
我想使用上下文初始化参数来初始化 bean,而不是通过FacesContext。在adfc-config.xml
(注:不是faces-confg.xml
)中,一些示例显示了对 的引用initParam
:
<managed-bean>
<managed-bean-name>reportBean</managed-bean-name>
<managed-bean-class>ca.corp.report.view.OracleReportBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>reportServerProtocol</property-name>
<property-class>java.lang.String</property-class>
<value>#{initParam['reporting.server.protocol']}</value>
</managed-property>
...
</managed-bean>
关键线是价值元素#{initParam['reporting.server.protocol']}
。但是,JDeveloper 显示该行不正确。也就是说,initParam
上下文在adfc-confing.xml
.
错误是:“EL 令牌initParam
未知。”
问题
使用EL,如何使用上下文初始化参数来配置托管 bean,在 ADFc 中以声明方式?
相关链接
- 如何通过@ManagedProperty 注解注入整个托管bean?
- http://balusc.blogspot.ca/2011/09/communication-in-jsf-20.html
- https://stackoverflow.com/tags/el/info
- http://www.oracle.com/technetwork/developer-tools/adf/learnmore/43-remote-task-flow-169185.pdf
- http://docs.oracle.com/cd/E25178_01/web.1111/b31974/taskflows_activities.htm