| h1. Via @EJB Annotation |
| |
| Which an be as simple as adding this to your Servlet, Filter, or Listener: |
| |
| {code} |
| @EJB |
| private HelloLocal helloLocal; |
| {code} |
| |
| See the [@EJB Injection Example|Injection of other EJBs Example] for a running example. The example uses one ejb to refer to another ejb, but the same rules apply for servlets. |
| |
| h1. Adding ejb-ref in your web.xml |
| |
| Or on the older xml-style: |
| |
| {code:xml} |
| <ejb-ref> |
| <description> EJB Reference to the bean deployed to OpenEJB </description> |
| <ejb-ref-name>ejb/hello</ejb-ref-name> |
| <ejb-ref-type>Session</ejb-ref-type> |
| <home>org.acme.HelloHome</home> |
| <remote>org.acme.Hello</remote> |
| </ejb-ref> |
| {code} |