Step by step in JBuilder5 integrated Oracle 9ias development web application (2)

zhaozj2021-02-17  74

The second one, release a simple webApp example.

The simplest, it is HelloWorld, let's use servlet to output a Hello World, release it to OC4J.

The following example is that you have mastered the method of developing a servlet in JB, and the OC4J is configured in JB according to the first article.

Step 1: Open JB, newly create a web application. We named HelloWorld, in the Context Settings page, we name the Context name called Test, click Generate War, and we demand that the WAR file is generated. The directory is wwwroot. carry out.

Then, in this project, create a new servlet, named helloservlet, all waypoint next, last Finish. Then we change the output of the automatically generated Helloservlet.java to Hello World.

Compile, trial operation, JB will run this servlet with your own Tomcat, you can see that Hello World is displayed normally.

Build a new EAR again, you can find in the New - Enterprise page. One way new, take the system default value, when setting Web Modules, we click Test.war. Add Test.War to EAR. This EAR file is named HelloWorld.ear.

Right-click HelloWorld.earGRP, select Properties in the pop-up menu. Set the target Container Name to be published in the property page to set the DEPLOYMENT. We choose Jiwei. (It is we set in the first one).

In the second step, let's post to OC4J.

Start your OC4J server first, then pop the OC4J published window from Tools - EJB DELOPYMENT. Click Depoy, wait a moment. If you are released normally, OK, you can see the Hello World.

If you change the servlet, how to reload? Very simple, we changed the output as Chinese, change the output string in helloservlet.java "Hello, China."

Right-click HelloWorld.eargrp, first rebuild it, recompile. REDEPLOY it, reload. Ok, you refresh it in IE, you will find that the output string becomes Chinese.

Everything is so simple. If you have any questions, please contact

Yancheng@sharetop.com

转载请注明原文地址:https://www.9cbs.com/read-30185.html

New Post(0)