!--a11y-->
Accessing J2EE Applications from Portal
Applications 
Portal applications can access J2EE applications such as EJBs and servlets. To do this:
1. Specify the reference
The reference is defined in portalapp.xml either in PrivateSharingReference or PublicSharingReference using the SAP J2EE application prefix "SAPJ2EE::"
<property name="PrivateSharingReference" value="SAPJ2EE::sap.com/Hello"/> |
The application is accessed via JNDI. The following is an example of a portal component accessing an EJB

public void doContent( IPortalComponentRequest request, IPortalComponentResponse response) { String key = "Hello/Stateless/HelloStatelessBean";
try { Context context = new InitialContext();
Object obj = context.lookup(key); HelloHome home = (HelloHome) P4ObjectBroker.init().narrow(obj, HelloHome.class); Hello hello = home.create(); response.write("Bean message: " + hello.getMessage()); |
