Developing for WebLogic Server 8.1 with Oracle JDeveloper 10g
Pages: 1, 2, 3, 4, 5

The business method getAppServer() is exposed through the SessionEJBLocal interface. Next, create a JSP client for the session EJB. Right-click on the View project node in the Applications-Navigator, and select New. In the New Gallery frame, select Web Tier>JavaServer Pages in the Categories, and select JSP Page in the Items listed. In the Create JSP frame, specify a file name and a directory name for the JSP. The JSP will be added to the View project. We want this new JSP to invoke the getAppServer() business method of the session EJB in the Model project. Although this is not sound MVC practice, the purpose of this tutorial is to explore features of the IDE, not to write excellent code! The J2EE library is required in the classpath of the View project.

Figure 11
Figure 11. weblogic.jsp in the Applications Navigator

Select Tools>Project Properties to add the J2EE library to the View project. In the Project Properties frame, select Profiles>Development>Libraries in the Categories listed. Transfer the J2EE library from the Available Libraries frame to the Selected Libraries frame. The J2EE library has the javax.ejb package Enterprise JavaBeans classes and interfaces.

Figure 12
Figure 12. J2EE Library

In the client JSP obtain a SessionEJBLocalHome object from the session EJB JNDI. From the SessionEJBLocalHome object create a SessionEJBLocal object and invoke the getAppServer() method:

InitialContext ctx=new InitialContext(); 
Object objref =  ic.lookup("SessionEJB");
 model.SessionEJBLocalHome
sessionEJBHome=(model.SessionEJBLocalHome)objref;
model.SessionEJBLocal sessionEJB=sessionEJBHome.create();
out.println(sessionEJB.getAppServer());

The weblogic.jsp client JSP for the session EJB is illustrated below.

Figure 13
Figure 13. weblogic.jsp

We have created a session EJB and a JSP for the session EJB. Next, create an EJB JAR file for the session EJB. Right-click on the Model project node in the Applications-Navigator, and select General>Deployment Profiles in the Categories listed. Select EJB JAR File in the Items listed. Click on the OK button.

Figure 14
Figure 14. New EJB JAR file

In the Create Deployment Profile frame, select the default deployment profile name and directory, and click on the OK button. In the EJB Jar Deployment Profile Properties frame, select the default specified values for the EJB JAR File, enterprise application name, ejb1, and click on the OK button.

Figure 15
Figure 15. EJB JAR Deployment Profile Properties

A deployment profile for the session EJB will be added to the Model project.

Figure 16
Figure 16. EJB Deployment Profile

Next, create a WAR file for the JSP. Right-click on the View project node, and select New. In the New Gallery frame, select General>Deployment Profiles in the Categories listed and WAR File in the Items listed. Click on the OK button. In the Create Deployment Profile frame, specify a deployment profile name and a directory name (or select the default values), and click on the OK button. A deployment profile for the JSP will be added to the View project.

Figure 17
Figure 17. Web Application Deployment Profile

Pages: 1, 2, 3, 4, 5

Next Page ยป