javaweb项⽬完整案例源码+sql_⽆框架版JavaWeb项⽬完整
案例实战(⼆)——基。。。
基础配置:
⾸先我们要新建⼀个Java Web项⽬,这个不详细讲了,百度⼀搜⼀⼤堆。这⾥展⽰下Java Web项⽬的结构,这是后⾯会经常⽤到的。
⽬录结构1
⽬录结构2
以下为各个⽂件解释:
1.⽂件夹dbSystem,项⽬名字是随便起的
2.WebContent⽂件中有⽂件WEB-INF,WEB-INF这个名字是固定的
3.WEB-INF⽂件夹中:classes⽂件夹,lib⽂件夹,l⽂件,这个名字都是固定的
l⽂件在tomcat⽬录中的conf⽬录⾥⾯有⼀个l模板
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="/2001/XMLSchema-instance" xmlns="/xml/ns/javaee" xsi:schemaLocation="/xml/ns/j  <display-name>dbSystem</display-name>
<welcome-file-list>
<welcome-file>login.html</welcome-file>
<welcome-file>login.htm</welcome-file>
<welcome-file>login.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
jsp⽂件、图⽚等等
5.其中WebContent⽂件夹下⾯还可以放⽂件夹、页⾯、css样式、jsp⽂件
6.classes⽂件夹中放的是编译后的.class⽂件
7.lib⽂件夹中放的是当前项⽬中运⾏所需要的jar包
java影视app源码
8.src⽂件夹下⾯全部都是java代码,⽐如servlet
以上为项⽬基本架构,同时为了能够运⾏还需要配置很多其他东西,⽐如c3p0如何配置等,这些也不详细介绍了,下⾯为我的配置数据。
同时需要提⼀下的是本项⽬⽤的数据库是postgresql,但是⽤法上和传统sql差不多,这⾥也不多介绍。
<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<!-- This app is massive! -->
<named-config name="mvcApp">
<property name="driverClass">org.postgresql.Driver</property>
<property name="jdbcUrl">jdbc:postgresql://localhost:5432/test</property>
<property name="user">*****</property>
<property name="password">******</property>
<property name="acquireIncrement">5</property>
<property name="initialPoolSize">10</property>
<property name="minPoolSize">10</property>
<property name="maxPoolSize">50</property>
<!-- intergalactoApp adopts a different approach to configuring statement caching -->    <property name="maxStatements">20</property>
<property name="maxStatementsPerConnection">5</property>
</named-config>
</c3p0-config>