OA Project 1: Database creation and environment additions for environment construction

Source: Internet
Author: User

First Note: This Learning tutorial for the Chuan Zhi Podcast Soup Sunshine Instructor published free OA Project video text version, I use this to strengthen their own development knowledge, if there are netizens reproduced, please specify. Thank you.

A specified database: Mysql

Database:oa

Build DATABASE statement: CREATE DATABASE OA default character set UTF8

Two specified IDE development tools: MyEclipse

Project name: New Web project, named: OA, and set Project Engineering code: UTF-8

Main technical framework used in the environment: Junit4,struts2.3.15.1,hibernate3.6,spring2.5.6,jquery, ...

Three Add frame environments:

1. Add the JUnit environment:

Right-click the project name--Build Path--Add Libraries-JUnit, click Next, select Version JUnit 4, click Finish. Complete the JUnit environment Add.

2. Add Struts2.3.15.1 Environment:

To add a jar package:

In advance to download the corresponding version of the project environment, unpack and open into the Apps folder, with a good press tools to open Struts2-blank.war, click Web-inf,

Copy all the jar packages below Lib to the Lib under our OA project.

To add a configuration file:

Open the Struts2-blank.war with a good press tool, click Web-inf, and copy the Struts.xml from SRC--and Java below to the SRC of our OA project. Then the

The content in Struts.xml is modified to read as follows:

1 <?XML version= "1.0" encoding= "UTF-8"?>2 <!DOCTYPE Struts public3 "-//apache software foundation//dtd Struts Configuration 2.3//en"4 "Http://struts.apache.org/dtds/struts-2.3.dtd">5 6 <Struts>7     8     <!--set to developer mode -9     <constantname= "Struts.devmode"value= "true" />Ten     <!--set the extension to. Action, as the contents of name do not remember, please find it in the default.properties inside the core package. - One     <constantname= "Struts.action.extension"value= "Action" /> A     <!--set the theme to simple, such as the name of the content can not remember, please in the core package default.properties inside Find - -     <constantname= "Struts.ui.theme"value= "simple" /> -  the     < Packagename= "Default"namespace="/"extends= "Struts-default"> -          -     </ Package> -  +     <!--ADD Packages here - -  + </Struts>

If the code of the XML is not prompted, look in the project package that we downloaded, the specific location is: STRUTS-2.3.15.1/SRC/CORE/SRC/MAIN/RESOURCES/STRUTS-2.3.DTD.

Then configure to myeclipse inside.

      

Open the Struts2-blank.war with a good press tool, click Web-inf, and copy the following contents of Web. xml into our web. xml:

1 <Filter>2 3         <Filter-name>Struts2</Filter-name>4 5         <Filter-class>Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</Filter-class>6 7     </Filter>8 9  Ten  One     <filter-mapping> A  -         <Filter-name>Struts2</Filter-name> -  the         <Url-pattern>/*</Url-pattern> -  -     </filter-mapping>

3. Add the hibernate3.6 environment:

To add a jar package:

1) Add Core package: Hibernate3.jar

2) Project Package Lib folder under: Required inside all jar package, JPA folder inside all jar package, optional folder C3P0 package.

3) MySQL driver package.

To add a configuration file:

1) Add Hibernate.cfg.xml, the specific template content is as follows (after the project environment has been added to the completion of the modification):

1 <!DOCTYPE hibernate-configuration Public2 "-//hibernate/hibernate Configuration DTD 3.0//en"3 "Http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">4 5 <hibernate-configuration>6     <session-factoryname= "Foo">7         <!--Show SQL -8         < Propertyname= "Show_sql">True</ Property>9 Ten         < Propertyname= "Hbm2ddl.auto">Update</ Property> One         <!--MySQL dialect - A         < Propertyname= "dialect">Org.hibernate.dialect.MySQL5Dialect</ Property> -         <!--Database connection Information - -         <!--Database-driven - the         < Propertyname= "Connection.driver_class">Com.mysql.jdbc.Driver</ Property> -         < Propertyname= "Connection.url">Jdbc:mysql:///oa</ Property> -         < Propertyname= "Connection.username">Root</ Property> -         < Propertyname= "Connection.password">Root</ Property> +         <!--Import Map File - <mapping resource= "Org/hibernate/test/legacy/simple.hbm.xml"/> - +     </session-factory> A </hibernate-configuration>

2) Add XX.hbm.xml template, the content is as follows (the specific code development to add changes):

1 <?XML version= "1.0"?>2 <!DOCTYPE hibernate-mapping Public3 "-//hibernate/hibernate Mapping DTD 3.0//en"4 "Http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">5 6 <hibernate-mapping Package= "Org.hibernate.test.typedmanytoone">7 8 </hibernate-mapping>

4. Add the Spring2.5.6 development environment:

To add a jar package:

1) Core Package:

Spring.jar

2) Dependent packages:

SPRING2.5.6/LIB/ASPECTJ all jar Packages below

Spring2.5.6/lib/lib/cglib the following jar package

Spring2.5.6/lib/jakarta-commons/commons-logging.jar (not required if added)

Add profile applicationconxt.xml, the template content is as follows (specific content is perfect when SSH is integrated):

1 <?XML version= "1.0" encoding= "UTF-8"?>2 <!--3 -middle tier application context definition for the image database.4    -5 <Beansxmlns= "Http://www.springframework.org/schema/beans"6 Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"7 Xmlns:context= "Http://www.springframework.org/schema/context"8 Xmlns:tx= "Http://www.springframework.org/schema/tx"9 xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdTen Http://www.springframework.org/schema/context Http://www.springframework.org/schema/context/spring-con Text-2.5.xsd One http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "
    > A  -     <!--automatic scanning and assembly of beans - -     <Context:component-scanBase-package= "Cn.clear.oa"></Context:component-scan> the      -      - </Beans>

OA Project 1: Database creation and environment additions for environment construction

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.