Background
A managed bean must have parameters configured through its web.xml file. The web.xml file defines context initialization parameters that are configured in JDeveloper (11.1.2.3) as follows:
The source for the definition of reporting.server.protocol
follows:
<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>
The bean exposes public accessor methods for reportServerProtocol
.
The source for the bean resembles:
@ManagedBean
@RequestScoped
public class OracleReportBean extends ReportBean {
@ManagedProperty("#{initParam['reporting.server.protocol']}")
private String reportServerProtocol = URLReportImpl.DEFAULT_PROTOCOL;
// ...
}
Problem
I would like to initialize the bean using context initialization parameters, rather than through FacesContext. In adfc-config.xml
(note: not faces-confg.xml
), some examples show references to 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>
The key line being the value element #{initParam['reporting.server.protocol']}
. However, JDeveloper shows the line as being incorrect. That is, the initParam
context is not available within adfc-confing.xml
.
The error is: "EL token initParam
is unknown."
Question
Using an EL, how can the context initialization parameters be used to configure a managed bean, declaratively within ADFc?
Related Links
- How to inject entire managed bean via @ManagedProperty annotation?
- 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