Eclipes3.0.1 + myeclipes3.8.2 Configuring Struts + Hibernate Application First Experience

xiaoxiao2021-03-06  43

The first time I wrote such a big blog, I feel very good, but I don't know why some things are written, some are not very clear, but no matter what to say, this is also an experience!

This article originally helped a friend who was engaged in WAP, the purpose was to help him upgrade their website to provide some technical support, but did not expect that this has become a chance to learn Hibernate, 嗷!

I will introduce you to eclipes3.0.1 myeclipes3.8.2 to run the RESIN service and equipped with struts1.1 and hibernate2.1.4.

1. Install JDK1.4.2 (C :)

2. Install the web server (c: resin)

3. Set environment variables

Classpath:.; C: /J2SDK1.4.2_04/lib/dt.jar; c: /j2sdk1.4.2_04/lib/tools.jar

PATH: C: /J2SDK1.4.2_04/bin; d: / oracle_cn / ora92 / bin; c: / program files / oracle / jre / 1.3.1 / bin; c: / program files / oracle / jre / 1.1.8 /BINHHYSTEMROOT%/system32;%ASystemRoot% ;%SystemRoot%/system32/wbem;c:/bea/jdk131/bin;; C: / Orant/bin;c:/RESIN-3.0.9;

4. Install Eclipes (c :)

5. Install language pack

Unzip nlpack-eclipse-sdk-3.0.x-win32.zip to C: / Eclipse Plugins / Eclipse_Language_Pack Directory

Then make a links file

New text files under c: /eclipse3.0.1/links and name com.eclipse.languagePack.LINK

Edit com.eclipse.languagePack.link

Path = C: // Eclipse plugins // Eclipse_language_pack

* After installing a new plug-in, it is best to delete the Configuration folder under C: / Eclipse3.0.1, and then start Eclipes

6. Install MyECLIPES

7. Register myElicpes

Sub: Hello

Sub cotel: uar7zl-835-56-54678656396403716

8. Configure RESIN services

OK, let us test it

New J2EE Web Project

Name: resintest

Let's take a look at our lovely catalog fence

JAR in J2EE has a lot, some is Options, you can delete it, but you don't have the relationship.

* As the configuration increases, more and more JAR will be added, may return to the mutual shield between JAR, no matter what to solve later

Then add a JSP page, this is nothing to say.

Below our project released

* After each modify the service configuration, you need to re-develop it here.

Let's start our service below.

Take a look at the service information

Look at the effect

This is this, the configuration and release of RESIN here is basically over.

9. On this basis, add Struts

After reading the app, after adding JAR, the catalog will look very messy. If you add other JAR, then the consequences are unimaginable.

So I recommend doing a few user-defined class libraries, which will be more convenient to manage, and it is better to look.

In view of the above JARs, they can be deleted.

Let's do Struts class library

Copy the Data directory under com.genuitec.eclipse.cross.easystruts.eclipse_3.8.2 to Eclipes / LIB and change the name to struts to configure Eclipes

Now transfer to the topic, start Struts

This looks more comfortable

* Warning: Do not change the JAR in the user class library, after the change, the user class library and the project class library point to the point of point, so pay attention to it

Start testing our struts

Modify TeststrutsAction

Modify Teststrutsform

Modify myjsp.jsp.jsp.jsp.jsp

Modify Web.xml

Modify ApplicationResources.properties

After re-release, restart RESIN

Look at the effect

success

failure

10. Last plus hibernate

Similarly, before proceeding, let's complete our user library.

Copy the Data directory under com.genuitec.eclipse.hibernate_3.8.2 to Eclipes / Lib and renamed Hibernate

And copy classes12.jar to Eclipse3.0.1 / lib / hibernate / 2.1 / lib and eclipse3.0.1 / lib directory

(If there is no this package, then the program will not find the database driver)

Start configuring Eclipes

Hibernate's jar has a lot of things, you can know which necessary is the necessary, this is to put it first, there is no impact on the back (I am too lazy, lazy check)

Then, the Hibernate frame is added to our Sample.

Before adding, first said two sentences, using the Hibernate Tool with MyEclipes to generate Pojo and HBM.

The first, there is no table in the database, this time you need you to write the structure of HBM, HBM.

Then use Run running xdoclet to generate Pojo (I haven't tried it myself, theoretically, I should be ^ _ ^)

The second, the database is originally a table, then this time we can use Eclipes to configure the database environment.

Then generate Pojo and HBM directly through the existing table (I tried, I tried, ^ - ^)

* Due to future projects, it is impossible for your program to design and build a table at all, if you let, DBA is to be unemployed),

So we only consider that there is already a table in the database. The first is very suitable for pouring data.

Tell the nonsense, let us start

First, those packages, methods, and STURTS above.

That's this, more tidy

Then we configure the database environment in Eclipes.

Let us change a few files, by the way, put the mistake to

Create a connection

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

New Post(0)