maven搭建spring mvc+ibatis项目

【SpringMVC】Intellij Idea搭建一个完整的 spring mvc项目 (附带ibatis的配置与使用) Intellij Idea + spring + ibatis + tomcat + maven打造一个简单的web项目 阅读详情

.背景介绍

  对于初学者,用maven构建项目并不是一件容易的事,springmvc并不是MVC中的主流,但是本人觉得springmvc比struts要好用,真正做到了零配置。一次使用,就放不下了。

二.准备工作

  1.Eclipse 3.7

  2.maven

  3.Eclipse 需要安装maven插件。url:maven - http://download.eclipse.org/technology/m2e/releases 。安装maven-3.0.4。并且选择本地的maven,如下图:

三.构建工程

  1.用maven插件构建项目框架

  maven具有强大构建功能,使用maven可以构建多种不同类型的工程。这里我们构建maven-archetype-webapp类型的项目。在Eclipse->New中选择other,找到maven Project型。如下图:

在选完路径之后,我们选择构建类型,如下图:

接下来,填写工程的Group Id,Artifact Id,如下图:

这里的Group Id就是大项目的id,Arifact Id就是该项目的Id。就像一个大项目中有许多小项目组成一样。此时,我们的项目已经成型了,样子如下图:

接下来,我们要完善项目的目录,配置。

  2.完善项目

  首先,完善目录,增加重要的source Folder,这个不是简单的Floder,这些文件夹是会参与编译的。增加src/main/java,src/test/resources,src/test/java目录。让目录变成标准的maven结构。如下图:

接下来,改变一些配置:

让工程的JDK用本地的jdk;

让工程的字符集为UTF-8;

改变工程的目录顺序;

  这些都完成之后,工程目录应该是如下的样子:

  3.将工程变成web工程

  此时,我们的工程还不是标准的web工程,可以在eclipse中增加web工程的特性,选择工程的Properties,选Project Facets,如下图:

这里,我们选择Dynamic Web Module,版本选择2.4,这个版本比较通用。如下图:

此时,我们看到目录中多了一个WebContent目录,由于使用maven构建,web目录是src/main/webapp,所以我们删除WebContent目录。接下来,要配置web项目的发布目录,就是Deployment Assembly,如图:

test目录不要发布,WebContent目录没有了,所以这三项都删掉。并且增加src/main/webapp目录,和Maven Dependenices,完成之后如下图:

于是,我们的工程就完全是一个web工程了。

  4.赋予工程的springmvc特性

  配置web.xml,使其具有springmvc特性,主要配置两处,一个是ContextLoaderListener,一个是DispatcherServlet。代码如下:  

[java] view plaincopy在CODE上查看代码片派生到我的代码片

maven搭建SpringMVC+spring+ibatis 是不是好东西你们去鉴定,SpringMVC + Spring + ibatis 可以配置多数据源,这个Demo 扩展性极强,就看你们自己如何发挥。 立即下载

相关推荐

maven 整合spring springmvc ibatis

maven 整合spring springmvc ibatis

eclipse maven 构建简单的web项目

--本文转自:http://www.cnblogs.com/fangjins/archive/2012/05/06/2485459.html 准备工作   1.Eclipse 3.7   2.maven   3.Eclipse 需要安装maven插件。url:maven - http://download.eclipse.org/technology/m2e/releases 。安

jisuanjixuezi的专栏 947

Cadence AMS数模混合仿真:从零搭建高效验证环境的实战指南

本文是Cadence AMS数模混合仿真的实战指南,详细介绍了如何从零搭建高效的芯片验证环境。内容涵盖环境准备、Testbench创建、核心Config视图与ADE设置、仿真运行调试及性能加速技巧,旨在帮助工程师解决SoC设计中数字与模拟模块的集成验证难题,确保芯片设计一次成功。

weixin_29164091的博客 324

maven+spring+springMVC+iBatis的整合

pom.XMl的配置 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 mcm.yuehou.maicaim hehe war 0.0.1-SNAPSHOT hehe Maven Webapp http://maven.ap

C_ptx的博客 1452

解锁医疗AI密码:医疗人工智能专业大学四年学习路径

医疗AI人才培养路径解析 本文系统梳理了医疗人工智能专业四年培养方案,分为基础、进阶、应用和拓展四个阶段: 大一聚焦基础学科,涵盖高等数学、医学概论、Python编程等核心课程,辅以医学数据认知实习。大二深入机器学习和医学数据处理领域,学习监督/无监督学习算法及医学影像分析技术。大三进入深度学习阶段,掌握CNN/RNN等神经网络模型,并实践医疗AI应用开发。大四关注前沿技术如大模型在医疗中的应用,完成毕业设计与企业实习。 课程体系强调医工交叉,每学期均配置实践环节,从基础编程到参与真实医疗AI项目,逐步培养

AllenLV的博客 2505

机械臂抓取前言

机械臂相关的笔记

weixin_64037619的博客 3910

maven+ibatis+spring mvc环境搭建

一、创建新的maven项目:         二、目录结构: 三、建立各个包及类: User.java package com.demo.entity; public class User { private Integer id; private String userName; private String password; pu

yyfpeak的专栏 2983

Flutter加载本地HTML的优雅解决方案:轻松实现富文本展示

通过以上步骤,我们实现了Flutter加载本地HTML的完整流程,并简单介绍了如何通过WebView与HTML页面进行交互。HTML文件作为一种灵活、易维护的富文本展示方式,能有效提升Flutter应用的内容呈现能力。这种方法在展示新闻、资讯或帮助文档等内容时非常有用,能够让开发者灵活调整内容的样式和排版。希望这篇文章能对你在Flutter开发中的HTML加载有所帮助!

四楼没电梯的专栏 3649

maven搭建spring mvc+ibatis项目 .

一.背景介绍   对于初学者,用maven构建项目并不是一件容易的事,springmvc并不是MVC中的主流,但是本人觉得springmvc比struts要好用,真正做到了零配置。一次使用,就放不下了。 二.准备工作   1.Eclipse 3.7   2.maven   3.Eclipse 需要安装maven插件。url:maven - http://downloa

流浪的虾壳 1704

Python量化交易实战:如何用pytdx库快速解析通达信.day文件(附完整代码)

本文详细介绍了如何使用Python的pytdx库高效解析通达信.day本地数据文件,构建免费、稳定的量化交易数据源。文章提供了从环境配置、基础数据读取、复权处理到板块信息获取的完整实战代码,并演示了如何将处理后的数据无缝接入Backtrader等回测框架,为量化策略开发提供可靠的数据基础。

ppp33的博客 1146

小米手机免登录开启USB安装与调试(MIUI 9-11实测,已Root可用)

本文详细介绍了小米手机免登录开启USB安装与调试的底层方案,适用于已Root的MIUI 9-11版本设备。通过修改系统配置、禁用MIUI安装器验证和强制开启USB调试等步骤,帮助开发者绕过账号限制,实现快速调试。文章包含不同MIUI版本的兼容性处理和常见问题解决方法,实测有效。

weixin_33675507的博客 290

maven项目的搭建——maven搭建spring mvc+ibatis项目(一)

[b][size=medium]怎么使用maven搭建spring mvc+ibatis框架项目呢?[/size][/b] 首先,一览实例项目的总体,如图: [img]http://dl.iteye.com/upload/picture/pic/131889/0027c1ab-d05b-3730-94d7-674fa6a37c3f.png[/img] [b][size=medium]...

A07151102108的专栏 362

机器人控制算法九之 位姿描述与空间变换

机器人控制算法九之 位姿描述与空间变换

yohnyang的博客 1034

ibatis的引入——maven搭建spring mvc+ibatis项目(三)

1、spring中引入ibatis配置文件,上章已有相关配置,这里再补充重点的。 [code="xml"] classpath:config/ibatis.xml [/code] 2、config/ibatis.xml的内容: [code="xml"] [/code] 3、config/ibatis_...

A07151102108的专栏 1230

[STM32F103C8T6]W5500+Modbus TCP(HAL库)

本章节是博主学习Modbus TCP所写的一篇文章Modbus TCP是Modbus的一个分支,主要用到网口通信的,在工业上也用的很频繁,我们公司最近的项目就是用的W5500+modbus TCP来和PC端的上位机通信和交互的。虽然这个项目不是我在写代码,但是我都学了Modbus RTU了,那我也抽空学习一下Modbus TCP吧。本次的Modbus TCP不是博主写的,是一个大佬开源的一个W5500写的一个Mobus TCP代码,我在这个基础上自己写了主机读从机多个数据,和主机写从机寄存器的函数。

sinat_58149788的博客 4086

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

spring mvc的搭建——maven搭建spring mvc+ibatis项目(二)

[b][size=medium]1、需要引入的jar包,已经在上一节的pom.xml中设置了。[/size][/b] [b][size=medium]2、web.xml[/size][/b] [code="xml"] contextConfigLocation classpath:/spring....

A07151102108的专栏 339

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Spring 中使用Log4j

pom.xml配置 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd

wodwl的专栏 737

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Spring MVC4+maven3+MyBatis3+Oracle11和mysql项目搭建

环境 MyEclipse 10、JDK 1.7、Tomcat 7.0 搭建 一、新建maven工程,步骤略,建好后目录结构如下图: 二、pom文件配置 [html] view plain copy project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi

天地人和 1508

Java - maven+ibatis+spring mvc环境搭建

1.准备工作: 要搭建者这样的一个框架 a.首先要创建一个maven的项目,然后转成web项目 具体的教程参考我以前的一个文章: Java-Eclipse使用maven搭建spring mvcb.要安装好mysql数据库 安装教程: http://blog.youkuaiyun.com/linpeng_1/article/details/699486822.开启搭建详细的教程: 教程地址:http:

屎壳郎情调-成长日记 2527

利用Intellij+MAVEN搭建Spring+Mybatis+MySql+SpringMVC项目详解

利用Intellij+MAVEN搭建Spring+Mybatis+MySql+SpringMVC项目详解 这两天在公司实习,师父让我先熟悉Intellij软件的使用和SpringMVC框架。话不多说,先利用这些搭建一个小环境吧。 1 创建MAVEN项目:File-NEW-MAVEN-create from..前打勾--选下面的org.apache..archetypes:maven-arc

noaman_wgs的博客 1万+

Maven整合Spring-MVC+IBatis

---------------------------------------------------------------------------------------------------------大神绕道-------------------------------------------------------------------------------------------

intmain_Rocking的专栏 3029

Maven项目环境搭建(Maven + Spring + IBatis)步骤

为什么80%的码农都做不了架构师?>>> ...

weixin_33816946的博客 854
上一篇: maven编译时出现读取XXX时出错invalid LOC header (bad signature)
下一篇: Spring MappingJacksonHttpMessageConverter
zljjava
博客等级 码龄15年 155粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值