ITeye博客

菜鸟入行

xsd_旧 · 共 36 篇文章

spring4 学习4 spring MVC+mybatis+Mysql

在前面搭建的基础上,引入新的jar包如下: aopalliance-1.0.jar aspectjweaver-1.8.8.jar mybatis-3.3.0.jar mybatis-spring-1.2.3.jar mysql-connector-java-5.1.31.jar spring-aop-4.2.4.RELEASE.jar spring-aspects-4.2.4.RELEASE.jar spring-jdbc-4.2.4.RELEASE.jar spring-orm-4.2.4.RELEASE.jar spring-oxm-4.2.4.RELEASE.jar spring-t…

2016-01-16 23:04 · spring4 · 评论(0)

spring4 学习3 web+velocity

在前面web工程的基础上增加velocity 1,jar包如下 更改spring-mvc.xml文件: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation…

2016-01-10 22:52 · spring4 · 评论(0)

spring4 学习2 webproject

工程结构与引用的jar包 web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name…

2016-01-10 22:44 · spring4 · 评论(0)

spring4 学习1 javaproject

jar包下载地址: http://maven.springframework.org/release/org/springframework/spring/4.2.4.RELEASE/ spring核心容器需要jar包5个,如果要通过在类上加注解的方式注入容器,则要添加spring-aop jar包 下面是工程引入的jar包: 源码如下: package com.xx.demo; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSyste…

2016-01-10 14:51 · spring4 · 评论(0)

通过webService传文件

1,客户端将 流转换为字符串,通过webService传 2,服务器端 将字符串转换为流,保存到本地 注:在webservice中传输的对象一定要实现序列化接口 涉及程序: 将流转为字符串: 1,将输入流转换为输出流 InputStream in = 输入流; byte[] buffer = new byte[1024]; OutStream out = new ByteAarryInputSteam(); int len = 0; while((len = in.read(buffer))!=-1){ out.write(buffer); } in.close(); 2,Base64.en…

2015-07-22 21:27 · webService · 评论(0)

使用save保存游离态对象获取其id

我使用的数据库是mysql, 1,在entity类的id处添加注解 @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; 2,在数据库建表时,写上auto_increment CREATE TABLE t_user ( id int auto_increment primary key, 自己试了试1和2缺一不可,

2015-07-19 23:16 · Hibernate · 评论(0)

设置地址栏前的图标

1,找一个16px * 16px 的图片,文件命名为 favicon.ico 2, 将该文件复制到根目录下 3,在页面中加入 <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <Link Rel="SHORTCUT ICON" href="<%=basePath%>favicon.ico">

2015-05-24 20:03 · web开发常用 · 评论(0)

spring-test环境搭建

1,我的目录结构 2,test/resource/spring-context.xml 与 src/resource/spring-context.xml 相同 包括:扫描包、声明事务等 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/…

2015-05-21 23:37 · spring · 评论(0)

被jsp中的路径困扰

最近使用SpringMVC,在前台页面跳转时总是存在路径跳转问题,所以直接写成了: <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> 页面中写href=<%=basePaht%>;+“to...”; 若js中有路径,则在页面最前面的script中写 var basePath = <%=basePaht%>; 然后在js代码中使用basePat…

2015-05-17 22:43 · web开发常用 · web前端 · 评论(0)

使用ajaxFileUpload插件实现图片无刷新上传

1,在页面 <script type="text/javascript" src="js/jquery/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="js/jquery/ajaxfileupload.js"></script> <script type="text/javascript"> function uploadimg(obj,id){ $.ajaxFileUpload({ url:'uploadImg.do', secureuri:false, //是否启用安全提交,默认为false fileE…

2015-04-14 00:05 · web开发常用 · 评论(0)

sping mvc3.1 json传输数据 中文乱码问题

1,问题:通过后台向前台传json数据(含中文),前台显示???? 解决: 在controller中修改为 @RequestMapping(value="/getType",produces="text/plain;charset=UTF-8") @ResponseBody public String getType(){ 。。。 return string; } 2,问题:前台向后台传json数据(含中文),,后台显示乱码 解决: 后台用 new String(test.getBytes("ISO_8859_1"),"utf-8");进行编码转换

2015-04-12 14:56 · spring · 评论(0)

mysql 学习3

索引 3. 索引的相关操作 上一讲我们介绍了索引的作用和种类,这一讲我们谈谈索引的相关操作! 1) 添加索引 前面已经有所介绍,这里总结一下 添加主键索引 [plain] view plain copy create table aaa (id int unsigned primary key auto_increment , name varchar(32) not null defaul ‘’); alter table 表名 add primary key (列名); 添加普通索引 [plain] view plain copy create index 索引名 on 表 (列名1,列…

2015-04-09 23:34 · 数据库 · 评论(0)

mysql 学习2

索引 在explain返回的结果中,有三个是和索引有关的(possible key、key、extra),可见索引在改善查询效率上的显著地位。 这一章,我们将全方位讲解如何使用索引来优化我们的数据库。 1. 索引的作用 索引的原理是利用特殊的查找算法(如二叉树算法),限制访问的行数,提高访问效率。 另外,索引还可以高效地在表之间建立连接操作,高效的对结果进行排序等等 2. 基本索引种类及创建 索引可以分为主键索引、普通索引、唯一索引和全文索引。 1) 主键索引 当一张表,把某个列设为主键的时候,则该列就是主键索引 [plain] view plain copy create table aa…

2015-04-09 23:33 · 数据库 · 评论(0)

mysql 学习1

文章来自: http://blog.csdn.net/hzy38324/article/category/3068221 show variables like 'long_query_time' 查询 慢查询 的时间 set global long_query_time=10000; 更改 慢查询 的时间 show variables like 'slow%'; 查询 慢查询的日志记录情况 set global slow_query_log=ON; 开启 慢查询的日志记录 日志在mysql安装目录的data下 计算机名+“-slow” Explain 的作用是生成一个QEP(查询执行计划)…

2015-04-09 23:30 · 数据库 · 评论(0)

Dom4j根据条件解析xml

用到dom4j.jar 工具类: import java.io.File; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; import org.dom4j.DocumentHelper; /** * 针对XML的解析 * 筛选符合条件的eleme…

2015-04-08 00:34 · xml · 评论(0)