Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCEEJBD
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
EJB Certification (OCEEJBD)
Lookup and name attribute for injection
Himai Minh
Bartender
Posts: 2418
13
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
On Frit's notes p.64-65,
package n1.notes.ejb; @Stateless @LocalBean public class InjectedBean{ EchoBeanRemote echo; @Resource SessionContext context; @EJB (name-"ejb/echo") public void setEcho (EchoBeanRemote echo){ this.echo=echo; } public String getInjectedBean(String phrase){ EchoBeanRemote g = (EchoBeanRemote) context.lookup("ejb/echo"); // or ("n1.notes.InjectedBean.echo") when "name" attribute is not used. // or ("java:comp/env/n1.nodes.ejb.InjectedBean/echo") when InitialContext.lookup() is used return g.echo(phrase); } }
I think on the last line of the comment, it should be
//or ("java:comp/env/n1.nodes.ejb.InjectedBean/echo") when InitialContext.lookup() is used and "name" attribute is not used.
Correct me if I am wrong.
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3411
320
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Correct!
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Accessing the Environment Values(Ejb-jar.xml)
Questions on Enterprise Bean’s Environment as a JNDI Naming Context
@Resource(name="x",lookup="y")
Questions on Declaration of Simple Environment Entries in the Deployment Descriptor
Home look up
More...