Use eclipse myeclipse Weblogic8.1 to develop the first web program

Source: Internet
Author: User

Use eclipse + myeclipse + Weblogic8.1 to develop the first web program

1. Install JRE
Although eclipse is developed by Java, it does not own JRE. Therefore, you must install it on your own and then renew it. After the installation is successful, restart the machine and add the bin folder path of JRE to the path of the system environment variable, for example, C:/program files/Java/j2re1.4.2 _ 03/bin.
2. Install eclipse2.1.2
Eclipse's latest stable has already been built to 3.0m5, but this version of javasagepackfeature has not yet been released. There is a problem with using javasagepackfeature2.1.2 directly. Therefore, it is recommended that you use eclipse stable version 2.1.2 with javasagepackfeature2.1.2 to implement a full Chinese interface. Eclipse SDK 2.1.2 and its release agepackfeature are http://download2.eclipse.org/downloads.
The installation of eclipseis very simple. You only need to extract eclipse-sdk-2.1.2-win32.zip and copy the folder eclipse to the desired place. Then, double-click eclipse.exe to compile and initialize eclipse. After that, the system automatically enters eclipse.
Next, install the languagepackfeature.
(1)uncompress eclipse2.1.2.1-sdk-win32-20.agepackfeature.zip.
(2) Start eclipse and select the "Help/software updates/update manager" menu to switch the main interface to the installation and update perspective screen.
(3) Right-click the feature updates view in the lower-left corner of the form and select the "New/Site bookmark" menu. The new site bookmark dialog box is displayed. Enter any name in the Name field, for example, languagepack. Enter the preceding URL (1) decompressed folder path, such as: file: e:/development tools/Eclipse/eclipse2.1.2.1-SDK-win32-LanguagePackFeature/eclipse. Click Finish to close the dialog box. In this case, the feature updates view displays a "languagepack ". Expand this item to see many Language Pack plug-ins.
(4) Select a Language Pack, for example, eclipse Java Development Tool Language Pack 1.2.1.2. Click the install Now button in the right view to start installation. After the installation is successful, eclipse restarts. Install all Language Pack plug-ins one by one. During the installation process, you will find that all interfaces are in simplified Chinese.
3. Install myeclipse2.7rc2
Download the latest myeclipseinstallation file myeclipse_eclipise_workbench_installer_020700rc2.exe from the http://www.myeclipseide.com. During the installation process, you must provide the path of the eclipse folder. After the installation is successful, the system automatically enters eclipse. In this case, you will find that "myeclipse" is added to the main menu. Then, select "window/Preferences" to open the preferences dialog box. Expand the myeclipse node and click the subscriber subitem. The 30-day version is displayed. But you can download the cracking program myeclipse_enterprise_workbench_v3.6.4.zip on the http://www.cracks4u.com. Run keygen.exe in zips, enter a username, select version 2.6.4, and click Generate to generate the subscribe code. Enter the user name and subscriber code in the subscriber and subscribe code text boxes and click the "Apply" button to see the information number of licenses: unlimited. So far, your myeclipse has been cracked.
4. Install Weblogic8.1
It is easy to install WebLogic, so I will not discuss it here. You can refer to the relevant documents. Now let's focus on WebLogic configuration, because the relevant information here will be used later When configuring myeclipse.
(1) Start/Program/BEA Weblogic Platform 8.1/Configuration Wizard.
(2) Select create a new WebLogic configuration and click Next.
(3) Select basic WebLogic Server domain and click Next.
(4) select Custom and click Next.
(5) enter Admin in name and localhost in listen address. The default values are used for the following two ports. Next step.
(6) Select skip to skip multiple servers, clusters, and machines options, and next.
(7) Select skip to skip the configuration of the JDBC connection pool (note: the configuration of the JDBC connection pool can be performed on the console after Weblogic is started. You can refer to the relevant documentation) and next step.
(Select skip to skip the JMS configuration (also left on the console) and click Next.
(9) continue to skip the next step.
(10) Select Yes and click Next.
(11) Click Add on the user page to add a user and password 12345678 at will. Next step.
(12) Assign the user to the Administrators group (you can also assign the user to another group by selecting the group to be added and then checking the check box before the user). Next step.
(13) Click Next to skip.
(14) set the user's permissions, select Admin, and check the check box before the user (to specify other permissions, and so on), and next.
(15) use the default settings and click Next to skip.
(16) use the default settings, and click Next to skip.
(17) Configure JDK and use the default WebLogic value. Click Next to skip.
(1. Finally, enter Dev in configuration name, click Create to generate the configuration, and then click done to close the Configuration Wizard dialog box.
5. Configure the WebLogic Server of myeclipse
The Default Application Server of myeclipse is jboss3. Here we use Weblogic8.1. Start eclipse and select the "window/Preferences" menu to open the preferences dialog box. Expand the application servers node under myeclipse, click JBoss 3, select the disable radio button on the right, and disable JBoss 3. Click WebLogic 8 and select enable on the right to enable the WebLogic Server. At the same time, the following configuration is as follows:
(1) Bea Home Directory: D:/Bea. Suppose Weblogic is installed in the D:/BEA folder.
(2) WebLogic installation directory: D:/BEA/weblogic81.
(3) Admin Username: user.
(4) Admin Password: 12345678.
(5) Execution domain root: D:/BEA/user_projects/dev.
(6) Execution Domain Name: Dev.
(7) Execution server name: Admin.
(8) hostname: portnumber: localhost: 7001.
(9) security policy file: D:/BEA/weblogic81/Server/lib/weblogic. Policy.
(10) JAAS login configuration file: omitted.
Expand the Weblogic 8 node, click JDK, and select the default JDK of Weblogic 8 in the wls jdk name on the right. The default value of j2re1.4.2 _ 03 in the box is j2re1.4.2, which is the JRE installed separately. Click Add to bring up the Weblogic> Add JVM dialog box. Enter a name in the JRE Name field, for example, jre1.4.1 _ 02. Select the JDK folder in the Weblogic installation folder in the main directory of JRE, for example, D:/BEA/jdk14000002. The program automatically fills in the javadoc URL text box and the JRE system library list box. Click OK to close the dialog box. In this case, you can select jre1.4.1 _ 02 in the wls jdk name combo box. The optional Java VM arguments, such as-ms64m-mx64m-djava. library. path = "D:/BEA/weblogic81/Server/bin"-dweblogic. management. discover = false-dweblogic. productionmodeenabled = false
Finally, click paths, and add D:/BEA/weblogic81/Server/lib/WebLogic through the Add JAR/zip button in the prepend to classpath list box on the right. jar, D:/BEA/weblogic81/Server/lib/WebServices. jar. If you use a database, you need to add the database Driver Class Library. Here we use the SQL Server database driver library D:/BEA/weblogic81/Server/lib/mssqlserver4v65. jar that comes with weblogic.
So far, the configuration of weblogic8 in myeclipse is complete. Next, let's see if WebLogic can be started in eclipse? After installing myeclipse, the eclipse toolbar has a run/stop servers drop-down button. Click the drop-down list of this button and select "WebLogic 8/start" to start weblogic. You can check the following console message to see if the startup is successful or if any exceptions occur. To stop WebLogic, select the "WebLogic/Stop" menu.
6. Create the first web program-helloworld
Start Eclipse:
(1) Select the "file/New/Project" menu to open the new project wizard. Select J2EE on the left, select Web module project on the right, and enter helloworld in project name processing. Click "finish" to generate the project file. The package view structure is as follows:
Helloworld
├ ── SRC
─ ── JRE System Library [j2re1.4.2 _ 03]
─ ── J2EE 1.3 library container
└ ── Webroot
(2) Click SRC, right-click, and select the "New/servlet" menu to create helloworld servlet. Enter servlet in the package name, helloworld In the servlet name, and remove the check box in the create doget check box. Next, use the default settings, and click "finish. The code for modifying the dopost method is as follows:
Response. setcontenttype ("text/XML ");
Printwriter out = response. getwriter ();
Out. println ("Hello World ");
Out. Flush ();
Out. Close ();
(3) Click webroot, right-click, and select the "New/html" menu to create an HTML page. Change file nameto index.html and click "finish. Replace the following code with the code between <body> and </body>:
<Script language = "VBScript">
Function bytes2bstr (VIN)
Strreturn = ""
For k = 1 to lenb (VIN)
Thischarcode = ASCB (midb (VIN, k, 1 ))
If thischarcode <& h80 then
Strreturn = strreturn & CHR (thischarcode)
Else
Nextcharcode = ASCB (midb (VIN, k + 1, 1 ))
Strreturn = strreturn & CHR (clng (thischarcode) * & h100 + CINT (nextcharcode ))
K = k + 1
End if
Next
Bytes2bstr = strreturn
End Function
</SCRIPT>

<Script language = "JavaScript">
VaR xml = NULL;
VaR xmlsender = new activexobject ("Microsoft. XMLHTTP ");
VaR url = "http: // localhost: 7001/helloworld/servlet/helloworld? ";
Xmlsender. Open ("Post", URL, false );
Xmlsender. setRequestHeader ("Content-Type", "text/XML; charset = UTF-8 ");
Xmlsender. Send (XML );
VaR MSG = bytes2bstr (xmlsender. responsebody );
Document. writeln (MSG );
</SCRIPT>
(4) Expand the WEB-INF node, double-click to open web. XML, add the following statement below </servlet-mapping>:
<Welcome-file-List>
<Welcome-File> index.html </welcome-File>
</Welcome-file-List>
(5) Click helloworld, right-click, and select "myeclipse/add and remove project deployments ..." In the displayed project deployments dialog box, select helloworld in the project combo box, click Add, select WebLogic 8 in the server combo box, and click Finish to return to the project deployments dialog box, the server information is displayed in the deployments list. Click OK to close the dialog box.
(6) Click the run/stop servers drop-down button on the toolbar and select the "WebLogic 8/start" menu to start the server.
(7) Run IE and enter http: // localhost: 7001/helloworld/index.html in the address bar to see "Hello World" on the page.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.