#This is the memo of relevant techniques you may use to build an EC site. (TBC)
- JavaEE, tomcat
- JDBC
- servlet
- JSP tbc.
- struts2 tbc.
- spring tbc.
- hibernate tbc.
- SSH tbc.
- spring-mvc tbc.
- MyBatis tbc.
- SSM tbc.
#####framework:
In computer programming, a software framework is an abstraction in which software, providing generic functionality, can be selectively changed by additional user-written code, thus providing application-specific software. —wiki
#####mainstream open source framework:
- UI: struts and springMVC
- DAL:hibernate and Mybaties
- BLL:spring
JavaEE, tomcat
3-tier architecture:
* UI: UI layer(presentation layer). The presentation tier displays information related to such services as browsing merchandise, purchasing, and shopping cart contents. It is a layer that users can access directly. (web and servlet) * DAL: Data access layer.it controls an application’s functionality by performing detailed processing. (access to the database) * BLL: Business logic layer. The data access layer should provide an API to the application tier that exposes methods of managing the stored data without exposing or creating dependencies on the data storage mechanisms. (deal with data received from frontend)###Web server:
UNIX & LINUX: Apache and Nginx
Windows:IIS
Apache: The most widely-used server. Written in C. Process static web page like HTML.
Tomcat: Donated by Sun. Open-source. Written in java. Process dynamic web pages like JSP and servlet.
normal flow:
client----HTTP request----Apache----servlet and JSP----Tomcat
###Tomcat:
####directory instruction
- Bin: .exe files, script file to turn on and off tomcat
- Conf: configuration files, core configuration file is server.xml
- Logs: log files
- Temp: temp files created when running tomcat
- Webapps: store web project publish directories(not source program)
- Work: .class files, JSP compile files
web project access path:
localhost:8080/virtual directory path
####three ways of mapping virtual path:
- 1.modify “host” in
server.xml
(not recommended)
<Host appBase=“webapps” autoDeploy=“true”…>
//add:
<context docBase=“web project path” path=“virtual path, for example:oracle”>
//you should reboot server after modification.
//one context represents for one web application
- 2.create a
xxx.xml
underconf/catalina/localhost
xxx stands for the virtual path.
you should write:
<context docBase=“web project path” path=“virtual path”>
in the xxx.xml file, you do not need to reboot tomcat.
if you want to create a multi-level directory, you should name the file like a#b.xml
, then the virtual path would be likea/b
-
- tomcat server can auto-manage web applications which are under Webapps directory, and map virtual path. in other words, web applications deployed under
/Webapps
, can be externally accessed directly
- tomcat server can auto-manage web applications which are under Webapps directory, and map virtual path. in other words, web applications deployed under
####Configurate Tomcat in Eclipse:
-
window—>preference—>server—>runtime environment—>add—>Apache Tomcat v7.0—>browse(find apache tomcat file )
-
window—>show view—>other—>server—>click the “no server” and choose tomcat7—>next—>finish(Tomcat is configured in eclipse)
when it succeeds, the red message “server startup in xx ms” shows up -
turn off apache
-
double click on tomcat, reset the overview
server locations: choose the second one,use tomcat installation(takes control of Tomcat installation)
Deploy path: webapps
Server Options: check on the second option,public module contexts to separate XML files
-
new dynamic web project
example:
-create hello.html under webcontent
-you can right-click on server, and chooseadd and remove
to add your project to it
-reboot server
-you can access the project byhocalhost:8080/java1first(your prject)/hello.html
-new dynamic web project
webcontent- - - -web-inf- - - -lib- - -copy class12.jar under it