简单框架搭建
只是简单的搭建项目总结,供以后学习用,不好,请见谅
友情提示:
eclipse中static web和dynamic web的区别
If you want to create a content-based Web application that does not contain any dynamic content (such as servlets, JSP files, filters, and associated metadata) you might prefer to create a static Web project, as opposed to a dynamic Web project.
一:struts2学习
1.简单的struts2搭建视频网址:
2.下载 支持servlet和支持 truts2的pom.xml内容网址:
http://mvnrepository.com/artifact/org.apache.struts/struts2-core
二:hibernate学习
1.视频:
Hibernate框架的搭建(添加Jar文件、附加源码,这里也讲解下载包)
http://v.youku.com/v_show/id_XODUwMTgxNjA0.html
2.文档参考:
http://blog.csdn.net/cl05300629/article/details/16826511
3.下载夹包网址:
(1)下载一个commons-logging-1.2.jar的夹包:
http://commons.apache.org/proper/commons-logging/download_logging.cgi
三:SpringMvc学习:
(1)Spring jar包官网下载地址:
http://repo.spring.io/release/org/springframework/spring/
(2)建立一个带Web.xml的项目方法
http://jingyan.baidu.com/article/90808022c495d9fd91c80f15.html
(3)Demo案列:
https://github.com/mafly/SpringDemo/tree/master/src
http://www.cnblogs.com/mafly/p/startJava.html
(4)成功例子
http://www.jianshu.com/p/0ccaa4af05fc
四:Spring学习
(1)下载Spring夹包:
http://repo.spring.io/release/org/springframework/spring/
(2)下载commons-logging.jar这个包:
http://commons.apache.org/proper/commons-logging/index.html
(3)junit环境搭建
http://blog.csdn.net/wangpeng047/article/details/9627527
(4)成功案例1
http://www.cnblogs.com/freeweb/p/5100131.html
(5)成功案例2
sorry,忘记了
总结Spring的注意点:知识点:
一:终于明白Spring为什么不通过new获取值了,通过配置,Spring工厂来完成!下面是例子。
(1)在src下可以建立xml文件,例如我的是
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- id为前面mian方法获取的值 -->
<bean id="helloWorlda" class="com.manongjc.HelloWorld">
<property name="message" value="要传的内容"/>
</bean>
</beans>
(2
在main中通过ApplicationContext获取xml文件,beans.xml为xml文件名
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");//加载.xml
(3)
通过context.getBean("helloWorlda");获取xml中的id。从而得到值-->"要传的内容"
(4)Configuration.xml不能有<!-- -->这样的注释,所以在博客园先提醒、记录
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC
"-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 配置数据源信息 -->
<properties resource="db.properties"/>
<!--获取数据库连接实例的数据源(DataSource)和决定事务作用域和控制方式的事务管理器(TransactionManager)-->
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="root"/>
<property name="password" value="123"/>
</dataSource>
</environment>
</environments>
<!-- 程序中所用到sql映射文件都在这里列出,这些映射sql都被Mybatis管理 -->
<mappers>
<mapper resource="cn/hans/mybatis/mapper/UserMapper.xml" />
</mappers>
</configuration>
(五)ssh搭建
(1)jar下载
struts2:http://struts.apache.org/
然后我来看一下hibernate 下载地址:http://hibernate.org/orm/downloads/
接下来我们了解一下spring,下载地址:http://projects.spring.io/spring-framework/
失败,没成功!
(六)学习maven
(1)maven下载:http://maven.apache.org/
失败
(六):ssm搭建
注意点1:先搭建struts2框架时,不要导入Struts2和Spring关联的jar,不然启动报错!!!
注意点2:我搭建时先搭建Struts2,然后Struts2+Hibernate,在其后Struts2+Hibernate+Spring,这里目前,Spring,只是帮助Struts2找到Action
浙公网安备 33010602011771号