JBUILDER + WebLogic implementation of teaching materials management system

xiaoxiao2021-03-06  88

Summary This article studies the method of reasonably use the original heterogeneous database to establish a relevant department management system in the campus network environment, introduces the design and implementation of the textbook integrated management system based on WebLogic application servers. Key words database; J2EE; EJB; WebLogic Introduction With the continuous improvement of science and technology, the function of computer networks has deeply recognized people. It has entered the various fields of human society and play an increasingly important role. Similarly, the campus network of various schools has also run many years, but there are still many school management systems lack unified planning, and the single-machine operation is still a lot, so it is necessary to further study rational use of the original use of the campus network environment. There is a method of establishing a management system for the heterogeneous database. In a college education and textbook warehouse already have its own independent database management system, but the textbook selection and other work are artificial, the labor amount, the efficiency is very low. The need to use existing resources to establish a textbook integrated management system in campus network environment is self-evident! This article describes the process of designing and implementation based on textbook integrated management systems based on WebLogic application servers. The system structure system contains teaching materials, query, modifications, order subsystems, system requirements, information and textbook information from the original database, as shown in Figure 1. Among them, the teaching and research room can be selected, inquiry, modification and other work through B / S mode, and the teaching materials are completed locally through the C / S mode through the C / S mode, mainly teaching materials or order and system management.

Design and Implementation of Textbook Integrated Management System 1. Database Design Among the database systems include the Academic Affairs Office Database (old), Warehouse Database (Old) and Textbook Commission Database (New), fully utilizing the purpose of the original resources to achieve sharing data, Used on the course of the course schedule, professional number table, warehouse in the warehouse. Academic Affairs Office Professional Table:

The column name data type length allows empty ID Bigint8 No Numint4 is an Academic Affairs Curriculum Schedule:

Column Data Type Length Allowed ID Bigint 8 No Cid Int4 No CName Varchar50 is Teachunitvarchar 50 is Sname Varchar 50 is a warehouse inventory:

Column Data Type Length Allowed BID INT 4 No Bname Varchar50 is BNOTE VARCHAR 50 is BAUTHOR VARCHAR 50 is BPRICE FLOAT 8 is BNUM INT 4 is the textbook committee's selection, order, unified management, it has one The local database is the textbook committee database, there are three tables in this newly into the database, one stored for the data after the selected data, a storage for the order for orders, the third is the information of the teaching and research room login password storage. Textbook table:

Column Data Type Length Allow Empty CID INT 4 No Bid Int 4 is CNAME VARCHAR 50 Yes BName Varchar 50 is Teachunitvarchar 50 is an order table:

Column name data type length allows empty ID Bigint 8 No BNameVarchar50 is NumNeed INT4 is a password table:

The column name data Type length allows for empty teachunitvarchar50 No PW Char10 is the underlying structure in J2EE, and the WebLogic application server connects the underlying database to configure the data pool and data source. 2, data pool and data source configuration Since there are three databases in the database system, three connection pools need to be configured when the WebLogic connection pool configuration is configured, here to enter the WebLogic console page to configure the first connection pool, an organizational database connection The pool (as shown in Figure 2) is an example. The most critical is to use the driver of the corresponding database category in the URL and DRIVER and fill in the database name to access, the address and port of the database server. Figure 2 Connection pool configuration

The URL of the warehouse database is: "JDBC: Oracle: CK: @localhost: 1521" Driver as: "Oracle.jdbc.Drive.racledriver" Teaching Committee's URL: "JDBC: WebLogic: MSSQLServer4: TeachingManagement@10.10.11.81: 1057 "Driver is:" WebLogic.JDBC.MSSQLServer4.driver "and then configures the data source, defines the JNDI name of the data source according to the data pool name. This connects the three databases distributed in different regions to WebLogic, and successfully masks the difference in the category, version, and geographical differences of the database software, with the data source configuration of the Academic Affairs Office, as shown in Figure 3:

Figure 3 Data source configuration

3. Establishing an entity EJB system To operate a total of six tables for three different land databases, thereby introducing and establishing the corresponding entity bean one by one, here will introduce the tables to be used in the three databases into the same EJB Module. In the entity bean generated in JBuilder, the name, data segment of the corresponding table, the name, attribute of the data segment are generated, and the basic action of the operation database is encapsulated according to the local or remote HOME interface file set by the programmer. The function of the record, the functions of the setting data item are found, etc., to add some functions for the back subsystem, add some functions in the course schedule Entity bean: a Finder named FindAll, function It is all information about the academic database course schedule. Use when writing all course information in the recipient textbook table. Another named FindBycid, the function is to find these courses based on the curriculum information entered. Add two Finder in the textbook table: a named Findall, in order to get information about all the textbooks. Another named FindbyBID, the function is to get a professional corresponding to the input textbook number. Add a Finder to Findall in Baobiao to get information in all order tables. This completes the establishment of this system entity bean. 4. Establish a session EJB to use session beans to model a customer's processing or control object, modeling workflow, task, and management activities, coordinating multiple entity beans, and controls the interaction of entity beans to apply logic. Transfer from the client to the server, the system is not particularly huge. Only one stateless session EJB (ConnecteJBS) with a remote interface is used to complete all the tasks that deal with entity EJB. For the need for system functions, six private variables are added therein, and 6 public variables are added to access six tables corresponding to entity EJBs. The initialization code is:

try {Context context = new InitialContext (); Object ref = context.lookup ( "java: / comp / env / Coursearrangement"); crthome = (CoursearrangementHome) ref; ref = context.lookup ( "java: / comp / env / XK "); xkhome = (xkhome) Ref; ref = context.lookup (" java: / comp / ENV / TP "); tphome = (tphome) Ref; ref = context.lookup (" Java: / comp / ENV / NumberHome = (NumberHome) Ref; ref = context.lookup ("java: / comp / enc / ck"); ckhome = (ckhome) Ref; ref = context.lookup ("java: / comp / ENV / Baobiao "); baobiaohome = (baobaohome) ref;} catch (exception e) {E.PrintStackTrace ();}

This will access the automatic generation of automatically generated and added in the real EJB through the remote interface of the session EJB, provided that this method or function is included in the home interface of the entity EJB. Some local public functions and multiple remote public functions have also been added to modify or access entity EJBs and make preliminary processing. The added function must first click on the graphic additive method (add method) representing a session bean first click on the JBuilder. After setting various parameters, right-click Session Bean to select the View Bean Sourse menu, enter the code area editing method, otherwise the project will generate compilation error. Here is a function of the translation of the database to the database throughout the system, which are useful in the following manner. 3 local public functions: In order to solve the independent function that cannot be written multiple times in the same function, 1Public void writecnotcname (Integer Cid, String CName, String Teachunit) This is the teachings of the textbook. 2public void Writebook (Integer Bid, String Bname) This time it is written to the order list. 3PUBLIC VOID WRITEALLTP (STRING Unit, String PW) is related to writing password information in the password table. Remote public function: The following function is the interface to which the subson system to be used (1 )public java.util.collection coukfo () This function is responsible for getting a course from the Academic Affairs Office. The return value is a Collection object. (2) PPUBLIC Boolean Writexk (java.util.collection RST) This function is automatically called in the running order subsystem. It is responsible for writing the curriculum information from the course information from the Academic Affairs Office when initializing the system, ensuring that both new teaching and research rooms can be obtained in real time. Its parameter is the return value of the function zhuany (), and the local function 1 is called in the program body. (3) Public Java.util.collection selectUnit () This function is to get all the names of the teaching and research rooms that open the course from the selection materials. In order to get the needs of the teaching and research charts in the STER name of the B / S, in order to be written in the classroom name in the password table. Note that there is repetitive information, and you need to call it in a function. ⑷Public Boolean WriteTP (Collection RST, String PW) This is to establish a teaching sector password table, in the function (2) post-adjustment, when there is no teaching and research room or a new teaching and research room, it will be automatically added to the password table and Assign the original password. It is a teaching material that the instructor can log in to the reproduced. ⑸Public Boolean Reflushbaobiao () This is when the C / S interface user refreshes orders information, writes the selected textbook information in the textbook table into the order table. It is called before getting the number of corresponding textbooks. ● The following is a function written in order to obtain the number of books you need to subscribe in the order, because multiple databases cannot be operated in a function, so the plurality of functions below are used. Get all the textbooks in the order table: public collection readbaobaoForgetnum ()

Get the courses corresponding to the selected textbook from the selection materials:

Public Integer ReadxkforgetNum (Integer Bid)

Then, from the Academic Affairs Office, the course of the course represented by this course number may not only one:

Public Collection ReadCouforGETNUM (Integer CID)

Then check these majors from the Table of the Academic Affairs Office:

Public Integer ReadnumforgetNum (Long ID)

Find out the stock of this book in the warehouse, if the required quantity is greater than in stock, you must display the purchase amount in the order:

Public Integer ReadckforgetNum (Integer Bid, Int Numall) ○ ● ○ This function is the function of the instructor online textbook and related unit queries to use. (1 )Public string login (String Unit) This is used when the user checks the password when the user logs in, is based on the user name to check the corresponding password and return. Verify if the user changes the password to use it to log in to the user. (2) PPUBLIC STRING LOGIN (STRING Unit) This function is known from the name. It is used when the user checks the password when the user logs in. It is based on the user name to query the corresponding password and return. Verify if the user changes the password to use it to log in to the user. (3) PUBLIC Boolean Writein (Integer CID, Integer Bid, String Name) This function is written to the appropriate database record after the user fills in the course information. ⑷Public Boolean SetPW (String Unit, String PW) This function is used when the user changes the password. ⑸Public Boolean Isbooksame (Integer Bid) This function is user filling whether the textbook information is repeatedly input, or when it is entered for the textbook that has been selected, it is used to prevent the database primary key from being repeatedly inserted. ⑹Public Object getBidName (Integer Cid) This is to provide a reference for the teaching materials for the teaching project. 5. The order subsystem is to achieve the control of the entire textbook, obtain the teaching materials order report, and the system reaches the above objects in the C / S end. It is not released, which is the local client of the Textbook Commission, where the order interface is shown in Figure 4.

Figure 4 Order interface in the order subsystem

When the system is started, the course information will be automatically obtained from the Academic Affairs Office, adding the textbook information of the textbook committee database, and the textbook information of the empty out and corresponding teaching and polishors will be added to the B / S terminal. Core code:

Conhome = (ConnectejbsHome) PortableRemoteObject.narrow (Ref, ConnectejbsHome.Class); try {con = conhome.create (); if (con.writexk ()) {system.rr.print ("You have succeeded Transferred data! ");}} Catch (exception ex) {ex.printstacktrace (); system.err.print (" Data Transfer Failed! ");}

It gets the HOME interface of the session bean, and the course information obtained by the session bean's method couinfo () is called Writexk () write to the selection materials table, waiting for the teaching room to select the textbook, and then assign the original password 88888. Core code:

Try {Con = Conhome.create (); IF (Con.WriteTP (Con. Zhengyi (), "888888") {System.err.Print ("Password Assignment Success!");}} Catch (Exception EX) {EX .printstacktrace (); system.err.print ("Password assignment failed!");

When the "Refresh Order" button is pressed, the following list box will present the information of the textbook that needs to be ordered, including the ISBN number of the book and the book and the number of orders. Implementation code is:

Conhome = (ConnectejbsHome) PortableRemoteObject.narrow (Ref, ConnectejbsHome.Class); try {con = conhome.create (); if (Con.Writebaobiao ()) {system.rr.print ("Report Data!"); if (this.getnum ()) {system.err.print ("Number of books!");}}} catch (exception ex) {EX.PrintStackTrace (); system.err.print ("Generate Report Failed! ");} Where WriteBaobiao () will use a series of functions written in session EJB to get the number of order books, here is not described here.

6, teaching materials selection system

Textbook selection is an online system. The core part is made with JSP, which will be very convenient to develop JSP with Dreamweavre4. This system does not select the application interface is to consider security needs. Applet needs to execute the program to the client, which is actually a c / s that can be opened by the web page, destroys the advantages of three-layer structure thin client, but Use can be considered in achieving parts that do not involve security. The selection interface of this system is shown in Figure 5.

Figure 5 Textbook selection system selection interface

A total of five JSP pages here are the main part of the online textbook selection system. Some JSP pages use the same JavaBean directly, enhance the reuse of the code, such as the login page and the password modified page with the PWBean's Javaean. In order for most logic to be implemented in session EJB, JavaBean as part of the JSP is short. Login.jsp is the login interface, which can automatically obtain all the teaching and research room names of the Academic Affairs Office, log in to Select.jsp through the password allocated by the Textbook Commission, and select the textbook. After select.jsp, the web page automatically gave the course responsible for the login teaching, here, gave the instructor to enter the unified number and name of the book he thinks the right book, of course, here is the only identified, successful Success page appears on Success.jsp. Here, there are also teaching and research rooms to modify the password navigation buttons, convert to the interface of the password, PWChange.jsp, here you need to enter the original login password, enter the new password two new passwords to really change the password. The success interface will appear after the modification is successful. The password is in the Textbook Commission database, and the security of JSP is completely existed here.

At this point, the core function has been implemented, and the functions of the query browsing of other units are slightly available.

The benefits of using the JBUILDER development system are that many functions are automatically completed by the system. After the above work is completed, only the engineering part is packaged into EAR (Enterprise Archive). Configure the server address, port, username password, and system automatically write the web application deployment information to the deployment description file Web.xml, just right click on the project release.

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

New Post(0)