1.项目的目录结构图:
2.web.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
5 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 6 7 8 <!-- spring监听器,监听springMvc环境 --> 9 <listener>10 <listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>11 </listener>12 <!-- 加载spring的配置文件 -->13 <context-param>14 <param-name>contextConfigLocation
</param-name>15 <param-value>/WEB-INF/springmvc-servlet.xml
</param-value>16 </context-param>17 <!-- 配置Spring MVC DispatcherServlet -->18 <servlet>19 <servlet-name>springmvc
</servlet-name>20 <servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>21 <load-on-startup>2
</load-on-startup>22 </servlet>23 <servlet-mapping>24 <servlet-name>springmvc
</servlet-name>25 <url-pattern>*.do
</url-pattern>26 </servlet-mapping>27 </web-app>
3
posted @
2014-03-15 10:36 若愚若怯 阅读(462) |
评论 (0) |
编辑 收藏
1.下图说明Spring MVC中请求被处理的过程:
posted @
2014-03-13 21:02 若愚若怯 阅读(161) |
评论 (0) |
编辑 收藏
Oracle:
|| 或 concat()
SQLServer:
+
MySQL:
CONCAT()
DB2:
|| 或 CONCAT()
posted @
2014-03-12 12:51 若愚若怯 阅读(111) |
评论 (0) |
编辑 收藏
示例:向学生表中添加记录
1.MySQL:
<insert id="addStudent" parameterType="Student" keyProperty="id">
insert into student(id,name,birth,score)
values(#{id},#{name},#{birth},#{score});
<selectKey resultType="int" keyProperty="id">
SELECT
LAST_INSERT_ID() AS VALUE
</selectKey>
</insert>
2.SQLServer:
<insert id="addStudent" parameterType="Student" keyProperty="id">
insert into student(name,birth,score)
values(#{#{name},#{birth},#{score});
<selectKey resultType="int" keyProperty="id">
SELECT STOCKIDSEQUENCE.NEXTVAL AS VALUE FROM DUAL
</selectKey>
</insert>
3.Oracle:
<insert id="addStudent" parameterType="Student" keyProperty="id">
insert into student(name,birth,score)
values(#{#{name},#{birth},#{score});
<selectKey resultType="int" keyProperty="id">
select @@identity as inserted
</selectKey>
</insert>
posted @
2014-03-10 10:55 若愚若怯 阅读(1336) |
评论 (0) |
编辑 收藏
代码如下:
String strDate = "2014-03-10";
StringTokenizer st = new StringTokenizer(strDate, "-");
Date date = null;
date = new Date(Integer.parseInt(st.nextToken()));
搞定!
posted @
2014-03-10 09:22 若愚若怯 阅读(291) |
评论 (0) |
编辑 收藏