- 浏览: 141582 次
-
文章分类
- 全部博客 (149)
- Java (41)
- 设计模式 (23)
- php (2)
- C++ (2)
- Linux (6)
- C (1)
- JavaEE (27)
- javascript (2)
- uplodify (1)
- Mybatis (2)
- Maven (4)
- Lucene (3)
- commons (1)
- Spring (7)
- SQL (3)
- mahout (1)
- MySQL (2)
- extjs4.2.1 (2)
- ubuntu (1)
- hadoop (1)
- hibernate (1)
- Spring JPA (2)
- JPA 2.0 (1)
- express (1)
- redis (2)
- angularjs (1)
- git (1)
- Python (1)
- logging (2)
最新评论
-
xlaohe1:
controller返回的是一个POJO对象,然后用@Resp ...
Spring MVC 4.X ResponseBody 日期类型Json 处理 -
TRAMP_ZZY:
能帮到你,我也很高兴。
Spring MVC 4.X ResponseBody 日期类型Json 处理 -
jobzjc:
第一段有帮到我。如果是非对象,Object方式传递的时候,第一 ...
Spring MVC 4.X ResponseBody 日期类型Json 处理 -
TRAMP_ZZY:
dingran 写道为什么,我怎么就没找到System > ...
Ubuntu 12.04 设置 IBus 开机启动 -
dingran:
为什么,我怎么就没找到System >> Pref ...
Ubuntu 12.04 设置 IBus 开机启动
applicationContext.xml
--------------------------------------------------------------------------------
xxx-servlet.xml
web.xml
----------------------------------------------------------------------------------
log4j.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" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <!-- Root Context: defines shared resources visible to all other web components --> <context:component-scan base-package="com.baobaotao.dao" /> <context:component-scan base-package="com.baobaotao.service" /> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/sampledb" /> <property name="username" value="root" /> <property name="password" value="root" /> </bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource"> <ref bean="dataSource"/> </property> </bean> <!-- 配置事务 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"> <ref bean="dataSource"/> </property> </bean> <aop:config proxy-target-class="true"> <aop:pointcut expression="execution(* com.baobaotao.service..*(..))" id="serviceMethod"/> <aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice"/> </aop:config> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="*"/> </tx:attributes> </tx:advice> </beans>
--------------------------------------------------------------------------------
xxx-servlet.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" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"> <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --> <!-- Enables the Spring MVC @Controller programming model --> <mvc:annotation-driven /> <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --> <mvc:resources mapping="/resources/**" location="/resources/" /> <!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/" /> <property name="suffix" value=".jsp" /> </bean> <context:component-scan base-package="com.bjfu.chapterone" /> <context:component-scan base-package="com.baobaotao.web" /> </beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- The definition of the Root Spring Container shared by all Servlets and Filters --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/applicationContext.xml</param-value> </context-param> <!-- Creates the Spring Container shared by all Servlets and Filters --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- Processes application requests --> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
----------------------------------------------------------------------------------
log4j.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <!-- Appenders --> <appender name="console" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.out" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%-5p: %c - %m%n" /> </layout> </appender> <!-- Application Loggers --> <logger name="com.bjfu.chapterone"> <level value="info" /> </logger> <!-- 3rdparty Loggers --> <logger name="org.springframework.core"> <level value="info" /> </logger> <logger name="org.springframework.beans"> <level value="info" /> </logger> <logger name="org.springframework.context"> <level value="info" /> </logger> <logger name="org.springframework.web"> <level value="info" /> </logger> <!-- Root Logger --> <root> <priority value="info" /> <appender-ref ref="console" /> </root> </log4j:configuration>
发表评论
-
ServletContainerInitializer 初始化器
2016-08-24 14:29 5121概述 为了实现不通过web ... -
Tomcat 7.X 配置https
2014-11-10 11:47 518http://tomcat.apache.org/t ... -
Spring Data JPA 实例
2014-06-30 01:08 1925[url][/url] 1. Sping Data JPA 创 ... -
Spring 4.0.3+Hibernate4.3.5+Maven 配置文件
2014-06-21 09:43 2309<?xml version="1.0&qu ... -
JavaEE Filter和Listener 分析
2014-02-18 14:18 8081. Filter 使程序可以改变 ... -
Servlet 3.0 文件上传新特性
2014-02-15 21:55 516Servlet 3.0 实现了文件上传的功能,通过注解的方式指 ... -
ServletContext 与ServletConfig剖析
2014-02-15 20:44 6631. ServletContext 是一个全局的储存信息的空间 ... -
JavaMail Spring Mail支持
2014-02-15 15:54 8021. 普通的JavaMail 发送和接受邮件 public ... -
Jdbc 数据库连接池简易实现和JdbcUtils
2014-01-20 16:42 712public class MyDataSource { ... -
Java反射将Jdbc查询结果封装为对象
2014-01-19 10:24 1286public class ORMTest { pu ... -
Spring JdbcTemplate CRUD 操作
2014-01-11 12:12 940/** * Project Name:cjxy ... -
JavaEE 下载文件中文乱码兼容多浏览器
2013-12-11 11:02 506public static String encodeF ... -
Spring 3.2.* MVC通过Ajax获取JSON数据报406错误
2013-09-12 12:13 659Spring 3.2.* MVC通过Ajax获取JSON数据报 ... -
Spring SqlQuery 使用
2013-09-11 17:52 696/** * Project Name:webblog ... -
JavaEE pager-taglib 分页插件(2)
2013-08-12 17:56 448/** * Project Name:TestPag ... -
JavaEE pager-taglib 分页插件(1)
2013-08-12 16:47 1141pg:pager 这个标签用来 ... -
Web 安全与 过滤器
2013-06-03 16:51 7841. Servlet 安全的四大要 ... -
JSP学习笔记二
2013-06-03 15:36 7791. JSP 标准动作获取 Jav ... -
JSP学习笔记一
2013-05-24 16:26 7941. JSP 最终还是会变成一个完整的Servlet 在W ... -
Servlet学习笔记(二)
2013-05-23 17:30 7061. Servlet 的初始化参数 配置: < ...
相关推荐
在【标签】中提到了Java、Eclipse、Maven和Spring Boot,这些都是构建Spring Boot应用的核心组件。 1. **JDK下载安装**: - 对于Windows用户,可以从Oracle官方网站下载适用于各自操作系统的JDK安装包,按照向导...
本文将详细解析如何使用Eclipse构建一个基于Maven的Spring MVC项目,并探讨相关知识点。 首先,Maven是一个强大的项目管理和构建工具,它通过依赖管理和项目信息管理,使得开发者可以更高效地构建项目。Maven使用一...
在Eclipse中构建Spring源码项目,可以帮助我们深入理解Spring的工作原理,从而更好地利用它来构建高效、可维护的Java应用。以下将详细阐述如何构建和探索Spring源码。 1. **获取源码** Spring源码可以从官方GitHub...
本教程提供的"用maven新建web项目.exe"可能是一个辅助工具,用于指导用户手动执行上述步骤,而"使用Eclipse构建web项目.txt"可能包含了详细的文字说明或步骤。通过学习这些资料,开发者可以掌握使用Eclipse和Maven...
本文将详细探讨如何利用Maven和Eclipse构建Web项目,尤其是以SpringMVC项目为例,深入讲解从项目创建到配置的全过程。 #### 一、创建Maven项目 创建Maven项目的第一步是在Eclipse中选择“File” -> “New” -> ...
6. **创建Spring配置文件**:在WEB-INF下创建spring-mvc-config.xml,配置Spring MVC的bean。例如: ```xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=...
然后在`User Settings`选项卡下,配置`User settings file`为Maven的用户配置文件`conf/settings.xml`。 4. **设置Maven镜像**:修改`settings.xml`文件,配置`mirrors`节点,设置国内的Maven镜像源,这样可以加快...
4. 创建Spring配置文件,定义Controller Bean和其他相关Bean。 5. 编写Controller类,实现业务逻辑。 6. 创建视图模板(JSP、Thymeleaf等),并配置视图解析器。 7. 在Eclipse中配置Tomcat服务器,将项目部署上去。 ...
本篇文章将深入探讨如何使用Maven作为构建工具,在Eclipse环境中搭建一个整合了Spring、Spring MVC和Hibernate的项目。 首先,让我们了解Maven。Maven是Apache开发的一款项目管理和综合工具,它通过一个项目对象...
本教程将详细介绍如何在Eclipse IDE中配置开发环境,包括Eclipse、Tomcat服务器、Maven构建工具以及Spring MVC的配置。以下是详细步骤: 1. **基础环境配置** - **JDK安装**:首先,你需要安装Java Development ...
通过学习和实践这个demo,你可以理解Spring MVC的基本工作原理,掌握如何创建Controller、配置DispatcherServlet、处理请求和响应,以及如何利用Maven管理项目构建。这将为你进一步深入Spring框架和Java Web开发打下...
【Eclipse Spring Boot Maven Web Demo 简单项目实例】是一个实用的学习资源,旨在帮助开发者快速搭建基于Spring Boot、Maven和Eclipse的Web应用程序。这个项目实例为初学者提供了良好的起点,让他们能够理解并实践...
Spring Cloud是一款备受推崇的微服务框架,它为开发者提供了在分布式系统(如配置管理、服务发现、断路器、智能路由、微代理、控制总线、一次性令牌、全局锁、领导选举、分布式会话、集群状态)中快速构建一些常见...
使用 Eclipse 构建 Maven 的 Web 项目 在本文中,我们将详细介绍如何使用 Eclipse 构建 Maven 的 Web 项目。首先,我们需要了解 Maven 的基本概念和 Eclipse 的 Maven 插件的使用。 一、直接建立 Maven 项目 ...
使用Eclipse构建Maven的Web项目用jetty启动 本文主要介绍了使用Eclipse构建Maven的Web项目,并使用jetty启动的步骤。下面是相关知识点的总结: 1. 使用Eclipse构建Maven项目 在Eclipse中构建Maven项目需要选择 ...
步骤8:创建servlet-context.xml文件(位于src/main/webapp/WEB-INF/spring/appServlet/),这是Spring MVC的核心配置文件。配置处理器映射器、视图解析器和其他组件: ```xml <beans xmlns="http://www.spring...