Author: Xiao Jing
1 Introduction to Beehive 1. What is Beehive? BEA extracts part of the WebLogic Server runtime framework, submitted to Apache after modification, forming today's Beehive. Beehive reflects several features that BEA added to WebLogic8.1: JPF (Java Page Flow), Simplified Resource Access Method - Control, Simplified Web Service Development, which makes J2EE more simpler; more important Yes, Beehive is no longer relying on the WebLogic Server environment, but can run in the vast majority of the containers that support servlet / JSP 2.3, which allows J2EE's application developers to provide BEEHIVE, at the same time can be between J2EE platforms Seamless transplantation. 1.2 Beehive Composition Beehive includes three parts, namely: Page Flow, Controls, and Web services.
1. Page Flow's MVC framework based on Struts, using JSR-175 to solve the automatic update of the Struts profile, which makes Struts development easier to implement the IDE tool, and provides some more easy to use features:
Status Management All Pages and Processing Actions in JPF are viewed as a session, and the variables declared in JPF can be accessed in each page, including JavaBean. [Note] When the user leaves the page stream, the data stored in the session state will be automatically released to use session data more efficiently. Therefore, multiple JPFs are unable to share session data. A set of label libraries in the rich data binding feature Page Flow provides binding between data and JSP pages to make the display interface programming easier. Concentrated exception handling can handle exceptions in a JPF or across a set of page flows in Globel.App. Obviously, we can easily handle an abnormality for the entire application set, allowing the program more flexible - such as common login timeout information, permission information, etc., you should judge every page, now You can judge at the entrance.
2. Controls Create a framework for lightweight J2EE components, you don't have to write a lot of code to do the following frequently:
It is used to create components that access resources such as databases, local files, web services. Business logic for packaging companies can be reused.
3. An implementation of Web Services JSR-181 supports web service development methods based on Javadoc annotation. 2 Start the work of the author's operating system is Windows2000. All the steps below are also for Windows2000. If you use other operating systems, you need to do some corresponding adjustments according to the following steps. If you need help, please via email: guilaida@163.com Contact the author. 2.1 Tool Download 1. Servlet Container - Tomcat5.5.8 In order to demonstrate the portability of Beehive, the servlet does not select WebLogic Server, but the other open source project of Apache is selected - Tomcat5.5.8, the following example is mainly Tomcat5. 5.8 Take the example, if you use other servlet containers or other versions of Tomcat, follow your environment to adjust. Tomcat download site: http://jakarta.apache.org/site/binindex.cgi
2. JDK1.5.x Because Tomcat5.x is developed based on JDK1.5.x, if you use JDK, you need to do some changes, so you can download 1.5 or above version of JDK, I The JDK version number is 1.5.0_01.3. The latest version of Beehive Beehive is 1.0, you can go to http://incubator.apache.org/beehive to download the installation package.
4. Ant Beehive Environment Preparation, the program compiles to use Ant as the build tool, so please download the latest version of Ant, the authors are 1.6 [Note] This should be thanked with BEA, they It greatly reduces the complexity of this work. 2.2 Software Installation 1. After installing JDK will use% java_home% to reference the JDK installation directory, such as the author installed in C: / JDK150, then% java_home% means C: / JDK150 this directory.
2. Install Tomcat to decompress the downloaded Tomcat compression package to a directory such as C: /TOMCAT5.5.8, which will use% tomcat_home by% tomcat_home by%.
3. Unzip Beehive to decompress the downloaded BeeHive compressed package to a directory such as C: /Beehive 1.0, will use% Beehive_Home% to represent this directory.
4. Installing ANT to decompress the downloaded ANT compression package to a directory such as C: / Ant1.6, will use% ant_home% to represent this directory. 2.3 Let Beehive's examples running in Beehive includes three aspects: Page Flow, Controls and Web Services. 8 examples have been taken in the Beehive Download Pack, which demonstrates a variety of different situations, which are located in the% Beehive_Home% / Samples directory. We first select three simple examples - NetUI-Blank, Controls-Blank, WSM-Blank, representing these three directions, now we start working, let these examples ran first. 2.3.1 Environmental Settings 1. Modify% Beehive_Home% / BeeHiveUser.cmd Sets the variables such as BeeHive_Home, Java_Home, Ant_home, CataLina_Home, and each corresponding installation directory. Here is the author's BeehiveUser.cmd file: @echo offrem Customize this file based on where you install various 3rd party componentsrem Such as the jdk, antid and tomcat.rem
Rem the root of beehive distributionset beehive_home = c: /beehive1.0
Rem location of a jdkset java_home = c: / jdk150
Rem location of antset ant_home = Ant1.6
Rem location of tomcatset catalina_home = c: /tomcat5.5.8
SET PATH =% PATH%;% java_home% / bin;% ant_home% / bin
2. Modify Tomcat Permissions Set to make Tomcat to be deployed in real time, you need to modify Tomcat's permissions settings, mainly to modify the% Tomcat_Home% / conf / tomcat-users.xml file, add a Manager role, add a user who belongs to Manager, The author is to expand the permission of Tomcat users to the Manager role. The following is the modified tomcat-users.xml: XML version = '1.0' encoding = 'uTF-8'?>
PATH = / PAGEFlow is the context path used by your web app C: /beehive1.0/sample/netui-blenk Please replace the absolute path to the NetUi_blank example in your Beehive
7. Test the http: // localhost: 8080 / pageflow in the browser if the following information indicates that your Page Flow is already running: New Web Application Page. 2.3.3 Let the Control example run the steps in steps 1 to 2 and 2.3.2 in the previous steps, followed by the steps to change as follows: 3. Prepare the Control Run-related JAR file and tag declaration file (.TLD) performing ant -f ant / webappRuntimeCore.xml -Dwebapp.dir =% Beehive_home% / samples / controls-blank deploy.beehive.webapp.runtime 4. compile the control performed ant -f% Beehive_Home% / samples / controls-blank / build. XML build command compiles controls in the Controls-Blank project. The controls in the example is simple, only one method hello, the role is to return "Hello!" 5. Deploy the control to the Controls-Blank environment: copy% Beehive_Home% / Samples / Controls-Blank / Build / MyControls. JAR% Beehive_Home% / Samples / Controls-Blank / WEB-INF / LIB, release the JAR file generated in step 5 to the lib directory of the Controls-Blank application.
6. Start Tomcat 7. Create a JSP file to create a helloworld.jsp file in the% Beehive_Home% / Samples / Controls-Blank directory, the contents are as follows: <% @ page language = "java" contenttype = "text / html; charSet = GB2312 "%> <% @ Taglib URI =" http://beehive.apache.org/netui/tags-database.0 "prefix =" Netui-data "%> <% @ Taglib URI =" http: // Beehive.apache.org/netui/tags-html-1.0 "prefix =" Netui "%> <% @ taglib URI =" http://beehive.apache.org/netui/tags-template-1.0 "prefix =" NetUI -Template "%> Call Demonstration The return of the Hello method with Control is: <% = hellobean.hello )%> strong> p> netui: body> netui: html> 8. Publishing the web application application context setting to control, the corresponding in the browser inputs as follows: http: // Localhost: 8080 / manager / deploy? path = / control & war = file: c: /beehive1.0/sample=true 9. Test In the browser input: http: // localhost: 8080 / control / helloworld .jsp, if the environment is successfully configured, the return information in the browser should be shown below: 2.3.4 Let the example of the web service run the steps in steps 1 ~ 2 and 2.3.2 in front of the previous steps, followed by steps Change is as follows: 3. Prepare WE B Service Run Master JAR File and Tag Declaration File (.TLD) Perform Ant -f Ant / WebApp.dir =% Beehive_Home% / Samples / WSM-Blank Deploy.wsm.Webapp.Runtime 4. Compile Demo The web service is used to perform ANT -F% Beehive_Home% / Ant / BuildWebapp.xml -dwebapp.dir =% Beehive_Home% / Samples / WSM-BLANK Build.Webapp command Compile Web services in the WSM-Blank project. The web service in the example is relatively simple, and only a method of method SayHelloWorld without parameters is released, returns "Hello World!". 5. Start Tomcat 6. Publishing the Web Application Application Context Set to WSM, the corresponding address is entered in the browser: http: // localhost: 8080 / manager / deploy? Path = / control & war = file: c: / beehive1 .0 / samples / wsm-blank & update = true 7. Test In the browser input: http: // localhost: 8080 / wsm / if the environment is successful, the return information in the browser should be shown below: Access Connect "Sayhelloworld", you can see the SOAP return message after accessing the web service: 3 Summary This article is concentrated in three aspects: Beehive Project Introduction, the project is required to run the software and environmental preparations and the steps that make the Beehive run on the Tomcat platform and related use commands. Through this paper, you should creating the required Web development environment according to the needs of different applications, and can be skilled, and deploy their web applications. The next article will be "page flow entry door", the author will simply analyze the operation mechanism of the page stream (JPF) frame, and how to apply the label development user interface under the page stream framework through specific examples, implement the page navigation, Processing the basic functions of form submission. Control Demo Instance - Test Page h3>