• 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

Weblogic 8.1 : JSP-SessionBean-EntityBean

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

If any one can assist me with this.

I need to access Session Bean from a JSP and Session Bean in turn acessing Entity Bean. What are the specific files where i need to make the settings. And at the same what changes i have to make in web.xml for JSP to access Session Bean.

If possible, a short sample example will be great input

thx
Deepak
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepak,


here is sample code to call EJB from JSP. Accessing EJB from JSP is not a good practise. Check this URL for multi-tiered applications



Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
h.put(Context.SECURITY_PRINCIPAL, user);
h.put(Context.SECURITY_CREDENTIALS, password);

Context ctx = new InitialContext(h);
Object o = ctx.lookup("ejb/myejb");// jndi name for your ejb
Mytesthome intf = (Mytesthome) PortableRemoteObject.narrow(o,Mytesthome.class);// your ejb home class
 
reply
    Bookmark Topic Watch Topic
  • New Topic