How can I pass init parameters to enterprise beans?

Robert Castaneda

You can specify Environment Entries that are accesssible by your EJB's. Inside your ejb-jar.xml you define the environment entries.

<env-entry>
<env-entry-name>theParameter</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>theValue</env-entry-value>
</env-entry>

You can access the variable inside your EJB using the Environment Naming Context (in EJB 1.1)

Context ctx = new InitialContext();
String val = (String)ctx.lookup("java:comp/env/theParameter");
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact