Abstract: Many J2EE Application Development Models are developed using JBuilder WebLogic Oracle, and JBuilder has a higher demand for machine configuration due to the large memory. This article introduces you to a convenience and provides a rich plugin and free visual programming tools Eclipse .. The development environment used herein is Eclipse WebLogic Oracle. The content of the environment, the creation process of the Conversation EJB, EjB (CMP) is briefly introduced, and the use method of the Struts framework is used.
Article catalog
:
Article title: Develop J2EE applications under Eclipse WebLogic ...
Article directory: ...
Text part: ...
One. Environmental preparation ...
Development Tools and Plugins Introduction ...
Install and configure environment variables ...
WebLogic 8.1 configuration and use ...
Eclipse configuration and use ...
Oracle configuration and use ...
II. Example overview ...
database...
Structural map ...
three. Create a stateless session bean.
jobs...
Create J2EE project ...
Create a STATELESS Session Bean.
Package Earleave.
four. Create CMP ---- UidGenerator.
task...
Create a CMP entity bean ---- UidGenerator.
Add business method nextValue.
Add a callback method ...
Add business methods in LeaveAccess ...
Create a test program ...
Fives. Create CMP --- LeaveApp.
task...
Create a CMP entity bean ---- LeaveApp.
Implement EJBCREATE Method ...
Increase query method ...
Add business methods GetleaveAppdata ().
Add a business method to LeaveAccessBean getAllleaveApp.
Add a business method SaveLeaveform for LeaveAccess.
Test CMP.
six. Create a web client ...
task..
Create Leave.jsp.
Create Display.jsp.
Article summary ...
Text part:
One. Environmental preparation
Development tools and plugins
1, JDK
J2se v1.4.2 http://java.sun.com/j2se/downloads.html
2, WebLogic
WebLogic8.1 http://dev2dev.bea.com.cn/
Application Server (APS) provides J2EE containers and excellent integrated development environments used by J2EE components.
3, Eclipse
Eclipse v2.13 http://www.eclipse.org/
J2EE integrated development environment.
Note: Don't go down 3.X, because Easystruts Plugin is written in the Eclipse 2.x environment instead of 3.x. Eclipse 3.x uses different formats and APIs for their Plugins. So you can't use it.
4, Oracle
Oracle8.1.7 http://otn.oracle.com/global/cn/software/products/oracle8i/index.html
Large and medium relational database
5, Lomboz
Lomboz.v213 http://www.objectLearn.com/index.jsp
Lomboz Tutorials http://www.objectLearn.com/support/docs/index.jsp
Eclipse develops EJB plug-ins
6, easystruts
EasyStruts http://sourceforge.net/projects/easystruts
Eclipase develops Struts plugin 7, Struts
Struts http://jakarta.apache.org/struts/
Web Framework (Framework) based on Module-View-Control (MVC) mode.
8, JasperReports
JasperReports http://jasperreports.sourceforge.net/
Powerful report generation tools that display rich text on the screen, print or convert into popular PDF, HTML, XLS, CSV, XML format.
Install and configure environment variables
1, JDK
Install J2SDK1.4.2 in C: J2SDK1.4.2
Set environment variables java_home = C: J2SDK1.4.2
Path =% PATH%;% java_home% in;% java_home% jrein;
ClassPath =% classpath%;% java_home% lib ools.jar;% java_home% libdt.jar;
2, WebLogic8.1
Install WebLogic8.1 in C: EA
Environment variables directly after installation
Path and ClassPath
3, Eclipse
Install Eclipse-2.13 in C: Eclipse
4, oracle8.1.7
Install Oracle8.1.7 in d: Oracleora81
5, Lomboz
Unzip Lomboz.213.zip and copy folders Features, Plugins in file clips and files to Eclipse's corresponding directory.
6, easystruts
Unzip org.easystruts.eclipse_0.6.4.zip, then copy com.cross.easystruts.eclipse_0.6.4 to Eclipse Plugins directory
7, Struts
Unzip JAKARTA-STRUTS-1.1 to C: Jakarta-Struts-1.1
Set environment variable struts_home = c: jakarta-struts-1.1
ClassPath =% classpath%;% struts_home% libstruts.jar;
8, JasperReports
Unzip JasperReports-0.5.0-Project to C: JasperReports-0.5.0
Set the environment variable classpath =% ClassPath%;
C: JasperReports-0.5.0distjasperreports-0.5.0.jar; C: JasperReports-0.5.0LibServlet.jar;
WebLogic 8.1 configuration and use
1. If the environment variable has been set, start WebLogic8.1 Configuration Wizard, create a new WebLogic Service. Establish all default configurations. After completing, a MyDomain's WebLogic Service will be created under MyServer.
2. Start WebLogic8.1, and open an IE, enter http: // localhost: 7001 / console in the URL, configure the new service's properties. Enter UserName and Password registered with WebLogic Service.
3. l If your Browser does not support Console, you can Download new Browser. There is no need to in general. Click the "Continue With My Current Browser" hyperlink below. .
4. l Click on "Deployerments" node -> "Web Application Medules", select "Deploy New Web AppLocation Medules", create a new application.
5. l Select the default directory of this Webserver: (Note: The directory contains the web-inflicity, with a folder with the web.xml file in the web-inflicity to be set to the default directory). Then click on "Target Modules" to complete it.
5.2 Start WebLogic8.1 CONFIGURATION WIZARD, select Extend An Existing WebLogic Configuration, click Next. Select the previously established WebLogic Service and click Next. Select DefaultWebApp, click Next, this will create a default web application.
6. You can view the resources of Application via the Monitoring tab.
test:
Restart WebLogic8.1, enter http: // localhost: 7001 / defaultwebapp / index.html in the URL of IE.
Locate the config.xml file under the Directory of WebLogic81 C: Eauser_ProjectsDomainSmyDomain_server (I created the corresponding webserver directory), find it in the file
IdentityandTrustLocations = "keystores" listenport = "7002" name = "myserver" />
This sentence. Add a line below it:
save.
Set a default directory for this application. You can enter http: // localhost: 7001 / index.html in the URL. Go to the WL81 home directory.
7. Close WebLogic8.1 Application Services
Select the previously established MyServer, right click to select START / STOP THIS Server ..., turn off the service.
Configure the connection pool and data source
1, configure JDBC
Start WebLogic Server, enter Console, point Connection Pool, select Configure a New JDBC Connection Pool ... Fill in the following information. General column:
Connection section: CapacityIncrement = 50maxcapacity = 100Capacity Increment: 5 Statement Cache Type: Lrustatement Cache Size: 5
Finally, click Apply, then go to Targets, select your server, point Apply.
At this point, the Connection Pool has been configured.
2. Specify the data source
Click DataSources to enter the configuration interface.
1. Click Configure A New JDBC Data Source .. Configure new DataSource 2. Fill in the following data: name: myds (you will start) JNDI: JDBC / ORACLEDS puts two items in the back.
Pool Name: Myora (must correspond to your Connection Pool's name) Click Create, then go to Targets, click Apply. .
The configuration is complete. . .
Eclipse configuration and use
1, install Eclipse
Unzip Eclipse-sdk-m20040218-win32.zip to C: Eclipse;
Unzip the Lomboz plug-in lomboz.213.zip, then copy to Eclipse's corresponding directory plugins; decompress the Struts plugin org.easystruts.eclipse_0.6.4.zip, then copy to Eclipse's corresponding directory Plugins;
Restart Eclipse after extracting copy to the plugins folder
2, configure Lomboz
2.1, Select Menu Window> Open Perspective> Java
2.2, Select Menu Window> Customize Perspective> Other, tick the Lomboz ActionS submenu, the toolbar will add a corresponding icon button on the toolbar, click it to appear on the workbench A Lomboz J2EE view
2.3, Select Menu Window> Customize Perspective> File> New, tick all nodes starting with LOMBOZ. After completing, many file types starting with Lomboz after our menu file-> new
2.4, Select Menu Window> Customize Perspective> Window> Show View, select the console, Lomboz J2EE View.
3, configure Eclipse
3.1, Select Menu Window> Preferences> Java> New Project, specify the file name of the source file and output file: Source Folder Name: Src; Output Folder Name: bin
3.2, Select Menu Window> Preferences> Lomboz, confident JDK Tools.jar is set to% java_home% lib ools.jar
3.3. After entering the Server Definitions child node under Lomboz, find the SERVER NAME, ServerDirectory, Username, Password, which is expected to be expected under Server Types.
4, configure Struts
4.1, Select Menu Window> Customize Perspective> File> New, select the Easy ××× item tick
4.2, Select menu Window> Preferences> Easy struts, select Struts1.1, point add jars, add% struts_home% lib * .jar; add TLDS, add% struts_home% webappsstruts-templateweb-inf * .tld;
Oracle configuration and use
1. Pay attention to the instance name and the corresponding table space when creating a database, and the settings of the rollback segment (see Oracle's corresponding book)
2, start SQL PLUS
3, log in to the database
My application environment login user name SB502, password SB502
Connect SB502 / SB502 (if it is connected to remote database using connection string Connect SB502 / SB502 @ alias)
4. Create a database orcl; (note that the corresponding authority should be given to the login user)
5, because I installed Oracle817, so put it into the environment variable in the corresponding lib directory of the WEB application in the WEBLOGIC81 installed in the Oracle directory. It writes into the lasspath of StarTwls.cmd to the launch script plus the Oracle driver to facilitate the configuration of the WebLogic8.1 connection pool.
Note: Oracle 8.17 and Pentium's four 1.7G CUP will have conflicts, and there is a problem that cannot be installed. At this time, you can copy the installation file of Oracle 8.17 to your hard drive, then search for "Symcjit.dll" file in the installation folder, you should find 2 and remove it properly. II. Example overview
database
1. There are two tables in the database ORCL that are automatically generated by CMP. The T_UIDGENERATOR has two fields: Name represents the application name, the UID represents the unique identification number of this app; T_LeaveApp has the following seven fields, represents the identification number of the leave, the employee number, the employee name, department, please leave the date, please fake days, please Reason.
Table T_UIDGENERATOR Table T_LEAVEAPP
Structural map
1, LeaveApp structure: Client Access data from the WEB request servlets (or JSP), servlet calls Session EJB --- LeaveAccess, and the access is implemented by the corresponding CMP EJB. (Note: The CMP is automatically completed by the EJB container to the database, all of you, is to rewrite the setXXX or getxxx method in the entity bean, then define CMP-Field in EJB-JAR.XML.)
2 LeaveAccessBean is a session ejb that encapsulates complex business interactions with entity Bean UidGenerator, LeaveApp, providing various data access interfaces for expression layers.
three. Create a stateless session bean
jobs
1. Create a J2EE project, named Myleave
2. Create a stateless session bean, package to com.ssss.Session, named LeaveAccess
3, deploy LeaveAccess Bean
Create a J2EE project
1. Point menu File> New> Lomboz J2EE Project, a creation wizard window will pop up.
2, enter the project name Myleave after Project Name, click Next
3, in the Java Settings window, determine Source Folders for Myleave / SRC (New), Output Folder is Myleave / bin, click Next Enter the Create J2EE Module window
4, click Add button under Web Modules, enter Module Name: WebLave
5, click the Add button in EJB Modules, enter Module Name: Ejbleave
6. Select Type to the Bea WebLogic Server V8.1 point Add button to add a server in the TargeTed ServerS box to the TargeTed ServerS box.
7. After completing the finish button
Create a STATELESS SESSION bean
1, select menu file> new> Lomboz EJB CREATION WIZARD will open the Create EJB window
2, specify package for com.ssss.Session, name is LeaveAccess, EJB TYPE is Stateless Session EJB
3, point finish is completed after the SRC directory creates a session bean for com.ssss.Session ---- LeaveAccessBean.
4. From the above figure we can see that it has created a Class Level Label (Tag): @ Ejb.bean, which indicates the type, name, name, name, and JNDI name that will be generated in the HOME interface. (Note: When we name it for bean, you don't need to end with the bean. Class, you can edit this file when you have some special needs, and please refer to the EJBDoclet section of the xdoclet document on the meaning of the tag and usage.
6,
7.
8. Expand the LeaveAccessBean node under the com.ssss.Session package, open the shortcut menu with the right click, select Lomboz J2EE> Add Ejb To Module, check before ejb [ejbleave], point OK Add a session bean to the EJB module.
9. Select Menu Window> show View> Lomboz J2EE View Open the Lomboz J2EE View view, you can see com.sssess.session.leaveAccessBean under the EJbleave module.
10. Right-click the node ejbleave in the Package Explorer view, select Lomboz J2EE> Generate EJB CLASSES. After completion of generation LeaveAccess.java, LeaveAccessHome.java, LeaveAccessLocal.java, LeaveAccessLocalHome.java, LeaveAccessSession.java, LeaveAccessUtil.java six java files in ejbsrc; generating ejb-jar.xml in EjbLeave> META-INF, jboss .xml, WebLogic-ejb-jar.xml.
stateless-session-descriptor>
reference-descriptor>
WebLogic-Enterprise-Bean>
To Add Enterprise Beans That You Have Deployment Descriptor Info for, Add
A file to your xdoclet merge directory caled weblogic-enterprise-beans.xml That Contains
The
->
WebLogic-EJB-JAR>
Packaging earleave
1. Right-click Myleave> New> Lomboz Ear Module, pop up the Create Ear Module window, rename the Display-name: Lomboz as Earleave, right-click Earleave Select Add Web Module Add a MyApp.war, right-click Earleave Select Add EJB Module Add a MyBean.jar. Set the display-name under EAR, Description is Leave Application Form.
2, select myapp.war under the left Leave Application Form, modify the web-uri on the right of Web-URI for WebLave.war, Context-root, selected WebLetave.
3, select MyBean.jar, modify the right EJB-JAR URI for EJbleave.jar. LINKED EJB MODULE Select Ejbleave.
Select Targeted Servers to complete the settings for the BEA WebLogic Server V8.1. The Earleave module will be generated under Myleave. Open the build.xml under meta-infault, delete the repetition of
4, expand the Myleave item under the Lomboz J2EE View view, right-click Earleave, select Deploy. (Of course, we launched the Bea WebLogic Server V8.1 Server in advance)
four. Create CMP ---- UidGenerator
Here's how to create a CMP. UidGenerator is a sequence generator that generates a unique identifier for each app. task
1. Create a CMP, package is com.ssss.cmp, named UidGenerator
2. Implement the EJBCREATE method: Pass all attribute values as parameters, call the corresponding set method settings.
3, add a business method to remove a available number: public integer nextValue ()
4, deploy UidGeneratorBean
5, add a business method to LeaveAccessBean: public integer nextValue (String name)
6, increase the callback method setentityContext, unsetentityContext
7. Create a client test program sessionclient, package to com.ssss.client
8, run the client program and test bean
Create a CMP entity bean ---- UidGenerator
1. Expand the Myleave node in the Package Explorer view, right-click SRC to open the shortcut menu, select New> Lomboz EJB CREATION WIZARD, specify Package: com.ssness.cmp in the Open EJB Create Wizard; Name: UidGenerator; EJB Type Select Container Managed Entity EJB. Point Next
2. Open the Container Managed Persistence dialog, specify schema name: uidgenerator; table name: t_uidgenerator;
3, specifying the field: name; field type: java.lang.string; Database column: name; SQL TYPE: VARCHER; SQL TYPE: VARCHER; then point the Add button will add one in the fields; select this item, point "make primary Key button
4, specify the field: uid; field type: java.lang.integer; Database Column: UID; SQL TYPE: IIT; SQL TYPE: INTEGER; then Point Add button will add one in Fields. After completing, click "Finish"
5. Complete EJBCREATE (String Name) method
Public java.lang.string ejbcreate () throws javax.ejb.createException {
String name = NULL;
SetName (Name);
SetUID (New Integer (0));
Return NULL;
}
6. Expand the SRC> com.ssus.cmp package in the Package Explorer view, right-click UidGeneratorBean.java, choose Lomboz J2EE> Add ejb to module, in the pop-up dialog box, then "OK"
7. Right-click EJBLEVE under the Package Explorer view, select Lomboz J2EE> Generate EJB Classes. Uidgenerator.java, UidgeneratorData.java, UidgeneratorLocalHome.java, UidgeneratorLocalHome.java, UidgeneratorLocalHome.java, UidgeneratorLocalHome.java, UidgeneratorLocalHome.java, UidgeneratorLocalHome.java, UidgeneratorLocalhome.java, Uidgeneratorutil.java. 8, @ Ejb.bean tag provides information about EJB: name, JNDi name, type, primary key, and schema (in query statement SQL)
@ Ejb.persistence tag provides table information corresponding to the CMP entity bean in the class level; provides mapping information of the bean persistence attribute and the database in the database in the Method level.
@ Ejb.pk-field tab defines the primary key
Add business method NextValue
1, the deployed Package Explorer view MyLeave> src> com.ssess.cmp> UIDGeneratorBean.java, right click UIDGeneratorBean, selected from New> Lomboz EJB Method Wizard, in the input dialog box Method Signature: public Integer nextValue (); Method Type selection business method; interface type selection local interface; then click "Finish".
2. Implement NextValue method:
3. Right-click Ejbleave under the Package Explorer view, select Lomboz J2EE> Generate EJB Classes.
Add a callback method
1. Import package javax.ejb.entityContext: import javax.ejb.entityContext;
2, add a variable domain ECONTEXT to store Entity Context: private entryxText ECONText;
3, add a method setentityContext and unsetentityContext;
4. Right-click EJBLEVE under the Package Explorer view, select Lomboz J2EE> Generate EJB Classes.
Add business methods to LeaveAccess
1, add a variable domain: UidgeneratorLocalHome Cache_UIDGENERATORLOCALHOME
Detailed operation:
3. Expand SRC> com.ssness.Session under the Package Explorer view> LeaveAccessBean, right-click LeaveAccessBean> New> Lomboz EJB Method Wizard. Specify Method Signature: Public Integer NextValue (String Name); Method Type: Business Method; Interface Type: Local Interface; Realization NextValue Method
4, add two Class level tags to make LeaveAccess and uidgenerator connection:
@ ejb.ejb-ref ejb-name = "uidgenerator"
View-type = "local"
Ref-name = "ejb / uidgeneratorlocal"
This label will generate a deployment descriptor in EJB-JAR.XML, so that LeaveAccessBean knows which bean it refers to, this bean is what type and this bean's reference name is.
@ jboss.ejb-ref-jndi ref-name = "uidgeneratorlocal"
JNDI-Name = "UidgeneratorLocal"
5. Right-click EJBLEVE under the Package Explorer view, select Lomboz J2EE> Generate EJB Classes. Then correct the error in the jboss.xml mentioned above.
6. Right click on the Ejbleave module under Myleave in the Lomboz J2EE View view, select Deploy. Create a test program
1. Expand the Myleave under Package Explorer, right-click SRC> Lomboz EJB Test Client Wizard, specified in the pop-up dialog
Package: com.ssss.client
Name: sessioncmpclient
EJB Home: com.ssss.Session.LeaveAccessHome (must be remote HOME)
EJB Interface: com.ssss.Session.LetAccess (must be a remote interface)
Target Server: Bea WebLogic Server V8.1
After completing, click "Finish"
2. Because the client test program cannot invoke the method in the LeaveAccess local interface, we remove the view-type = "local" descriptor under all methods in LeaveAccessBean.java, and then execute Generate EJB Classes, which will interface and These methods are generated in the remote interface.
3, add statement system.out.println in sessioncmpclient.java ("test:" mybean.printvalue ("test:"); save. Select SessioncmpClient, execute menu Run> Run As> Java Application, final The output is as follows:
4. Execute it again, will return Test: 2, the third time returns Test: 3, increment in turn.
Fives. Create CMP ---- LeaveApp
Below we create another CMP - LeaveApp, which provides some of the following interfaces: Get all review records, create new holiday records.
task
9. Create a CMP, package is com.ssss.cmp, named LeaveApp
10. Implement the EJBCREATE method: Pass all attribute values as parameters, call the corresponding SET method settings.
11, add a query method, specify its Query and Method as follows:
Query: SELECT Object (a) from LeaveApp As A
Method: "java.util.collection FindallLeaveApp ()
12, add a business method to take the current data: Public LeaveAppdata GetleAPpdata ()
13, deploy LeaveApp
14. Add a business method to LeaveAccessBean: Public ArrayList getAllleaveApp ()
15. Add a business method to LeaveAccessBean: Public Void SaveLeaveform (String, String, String, Date, Integer, String)
16, increase the callback method setentityContext, unsetentityContext
17. Create a client test program sessionclient, package to com.ssss.client
18, run the client program and test bean
Create a CMP entity bean ---- LeaveApp9, expand the Myleave node in the Package Explorer view, right-click SRC to open the shortcut menu, select New> Lomboz EJB CREATION WIZARD, specify the Package: com.ssness.cmp in the Open EJB Create Wizard; Name: LeaveApp; EJB TYPE Select Container Management Entity EJB. Point Next
10. Open the Container Managed Persistence dialog, specify schema name: LeaveApp; Table Name: T_LeaveApp;
11. Specify the field: uid; field type: java.lang.integer; database column: uid; sql type: integer; SQL TYPE: INTEGER; then click the Add button to add one in the fields. After completing the point "finish". Select this item, click "Make Primary Key" button to set it to the primary key
12. Specify Field: Employeeno under Persistent Fields; Field Type: Java.lang.String; Database Column: Employeeno; SQL TYPE: VARCHAR; then Point Add button will add an item in Fields;
13. Specify Field: Employeename under Persistent Fields; Field Type: Java.lang.String; Database Column: Employeename; SQL TYPE: VARCHAR; then Point Add button will add an item in Fields;
14. Specify Field: Department; Field Type: Java.lang.String; Database Column: DEPARTMENT; SQL TYPE: VARCHER; SQL TYPE: VARCHAR; then point the Add button will add an item in Fields;
15. Specify Field: Leavedate; Field Type: Java.util.date; Database Column: Leavedate; SQL TYPE: DATE; then Point Add button will be added to Fields;
16. Specify Field: LeaveDays; Field Type: Java.lang.integer; Database Column: LeaveDays; SQL TYPE: Integer; then point the Add button to add an item in Fields.
17. Specify Field: Reason; Field Type: Java.lang.String; Database Column: REASON; SQL TYPE: VARCH; SQL TYPE: VARCHER; SQL TYPE: VARCHAR; then point the Add button will add one in Fields; after completion, "finish" 18, Add @ Ejb.Persistence Table-name = "t_leaveapp" after deleting the label independent of LeaveAppBean.java.
Implement EJBCREATE Method
1. Call the SET method to set each field value
Increase query method
1, add tags at CLASS level
@ ejb.finder
Query = "SELECT OBJECT (a) from LeaveApp As A"
Signature = "java.util.collection FindallLeaveApp ()"
2. Expand the Package Explorer view Myleave> SRC> com.ssss.cmp, right-click LeaveAppBean.java, Lomboz J2EE> Add EJB TO Module> After selecting EJB [EjbleAve]. Add beans to the EJB module.
3. Right click EJBLEAVE, perform Lomboz J2EE> Generate EJB Classes. Generate related files.
Add business method GetleaveAppdata ()
1. Right-click LeaveAppBean, choose New> Lomboz EJB Method Wizard, specified:
Method Signature: Public LeaveAppdata GetleAPpdata ()
Method Type: Business Method
Interface Type: Local Interface
2. Implementing the construction method of LeaveAppData Realization GetleAVEAppdata
Add business methods to LeaveAccessBean getAllleaveApp
3, right-click LeaveAccessBean, choose New> Lomboz EJB Method Wizard, specified:
Method Signature: Public Java.util.collection getAllleaveApp ()
Method Type: Business Method
Interface Type: Local Interface
4. Add a variable domain private leaveApplocalhome cache_leaveApplocalHome = NULL in LeaveAccessBean;
5, add cache_leaveapplocalhome = LeaveApputil.getlocalHome () in LeaveAccessBean.ejbcreate ();
6. Call LeaveApplocalHome.FindallLleaveApp () Implement GetAllleaveApp () Method
Add business methods for LeaveAccess SaveLeaveform
1, right-click LeaveAccessBean, choose New> Lomboz EJB Method Wizard, specified:
Method Signature: Public Void SaveLeaveform (String Employeeno, String Employeename, String Department, Date Leavedate, Integer Leavedays, String Reason) Method Type: BusinessMeethod
Interface Type: Local Interface
2. Call LeaveApplocalHome.create () Implement the SaveLeaveform method.
3, add labeling at CLASS level
4, right-click EJBLEVE in Package Explorer, choose Lomboz J2EE> Generate EJB CLASSES
5. Modify the tag
6. Save the right-click Ejbleave in the Lomboz J2EE View view, choose Deploy
Test CMP
1. In order to test, we removed the Method level tag for LeaveAccessBean.java to remove-type = "local" to facilitate a corresponding method for client test programs in remote interface LeaveAccess.java.
2, after we get off the view-type = "local" tab before getallleaveform () and SaveLeaveform () method, right-click EJBLEVE> LOMBOZ J2EE> Create EJB Classes
3. Modify the error in jboss.xml and release (deploy).
4. Modify the TestBean () method in sessioncmpclient.java: first add a record, then output all records
5. Select the sessioncmpclient in the Package Explorer view, point menu Run> Run As> Java Application. The execution input is as follows:
6. Execute again, Leaveform will output two records, increment in turn.
7. The Package Explorer view at this time is as follows:
six. Create a web client
The following describes how to create a web client in an expression layer. The two most common examples of the client are to create a servlets and JSP pages. In the MVC mode, servlets actues Controller, JSP acts as View.
task
1, create Leave.jsp, Leaveform, and LeaveAction
2, create Display.jsp, Displayform, and DisplayAction
3, package release
Create Leave.jsp
1. Right-click WebLet> New> Easy Action Accosied with A Form, pop up the Struts New window, set the webapp all for / webleave, base package for generation for com.ssss.struts; point "Next"
2. Enter the Struts Form Settings window to set Use Case as Leave. Add the Add button after point Form Properties.
3. Enter name as Employeeno in the pop-up FORM Properties dialog, point OK
4, in the same, add attributes such as Employeename, Department, LeaveDate, LeaveDays, REASON. TYPE takes the default java.lang.string, JSP input type takes the default text. Click Finish to return to the Form dialog. 5. Click Next to enter the Struts Action dialog. Set input to /leave.jsp, click Next
6. Add the add button after point forward, set Forward Name for Success, forward path as /display.do. Point OK. Complete all settings.
7, add the following information to the ApplicationResources.properties of com.ssss.struts:
8. Slightly modified for Leave.jsp, as follows:
9. Complete LeaveAction.java. Save the resort record when submitting the form. After successful, turn to the display page.
10. Complete Leaveform.java Validate () method: remove an exception, return to null value return null;
Create Display.jsp
1. Right-click WebLave> New> File, create new files in WebLail style.css:
2, right-click WebLave> New> Lomboz JSP Wizard, New Display.jsp Page:
<% @ Taglib URI = "/ Web-INF / STRUTS-Bean.TLD" prefix = "bean"%> <% @ Taglib URI = "/ Web-INF / STRUTS-HTML.TLD" prefix = "html"%> <% @ Taglib Uri = "/ Web-INF / STRUTS-LOGIC.TLD" prefix = "logic"%>
| | | t> | tH> | tH> tr> | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<
Bean: Message Key = "No_Record" /> td> tr> logic: Empty> 4. Remove the hook before the Create JSP INPUT, remove the hook of the validate (), reset () method under Create the Method, then point finish to complete. 5. After completion, it will be generated in the com.ssess.struts.form package in the SRC, add 6, New> Easy Action, Set Use Case to Display, Form Name is DisplayForm (point Browse ..., then select), input is /display.jsp (point browse ..., then select) 7, click Next, point Forwards After the Add button, set Forward Name for Success, forward path for /display.jsp. DISPLAYACTION.JAVA will be generated in the com.ssss.struts.Action package after the point OK is generated, and the 8. Add the following tags in web.xml: ejb-local-ref> 9, add: Fill in the false list 10, use Http: // localhost: 7001 / Leave Access, test. Article summary This article first discusses several common development tools and their configuration use, and then focused on the integrated solution for Eclipse and the BEA WebLogic Server 8.1 and Oracle database: how to create session beans; how to use entity beans to access data; how to use JSP Call the interfaces and methods provided by EJB access data, hoping to learn together with the majority of WebLogic development users and make progress together. I also thank the Dev2dev Forum to provide us with technical support for our developers. Reference: Lomboz installation configuration http://www.objectlearn.com/support/docs/installation/install.jsp |