• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
山高我为峰
博客园    首页    新随笔    联系   管理    订阅  订阅

随笔分类 -  Java

上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
关于Spring事务<tx:annotation-driven/>的理解(Controller可以使用@Transactional)

摘要:在使用SpringMvc的时候,配置文件中我们经常看到annotation-driven 这样的注解,其含义就是支持注解,一般根据前缀 tx、mvc 等也能很直白的理解出来分别的作用。 就是支持事务注解的(@Transactional) 、 就是支持mvc注解的,说白了就是使Controller中可... 阅读全文
posted @ 2016-01-23 19:39 山高我为峰 阅读(1984) 评论(0) 推荐(0)
整合Struts2与Spring

摘要:一、需要的JAR文件为:Spring和Struts2框架本身需要的JAR文件以及他们所依赖的JAR文件二、在web.xml中增加WebApplicationContext的相应配置,以下两种配置方式本质是一样的。1. Servlet 2.3及以上版本可以使用监听器,相应配置如下: ... 阅读全文
posted @ 2016-01-23 17:07 山高我为峰 阅读(384) 评论(0) 推荐(0)
Cannot locate the chosen ObjectFactory implementation: spring

摘要:错误信息:Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location] at org.apache.struts2.config.AbstractBeanSelectionP... 阅读全文
posted @ 2016-01-23 16:26 山高我为峰 阅读(849) 评论(0) 推荐(0)
generator自动生成mybatis配置和类信息

摘要:generator自动生成mybatis的xml配置、model、map等信息: 1、下载mybatis-generator-core-1.3.2.jar包。 网址:http://code.google.com/p/mybatis/downloads/list?can=3&q=Product%3D... 阅读全文
posted @ 2016-01-22 15:14 山高我为峰 阅读(280) 评论(0) 推荐(0)
Java截取图片的一部分并保存为40*40的图片

摘要:@Test public void testImag() { try { String path = "E:/flower2.jpg"; int x = 11, y = 20, cutW = 280, cutH = 280; ... 阅读全文
posted @ 2016-01-21 17:38 山高我为峰 阅读(1732) 评论(0) 推荐(0)
HQL查询中取个别几个字段

摘要:数据表:要求:查询type为4001,以content分组,本计算不重复的pcInfoIdMySQL语句:SELECT COUNT(DISTINCT pcInfoId) AS COUNT,content,TIME FROM vrv_paw_reportlog WHERE TYPE='4001' GR... 阅读全文
posted @ 2016-01-20 17:42 山高我为峰 阅读(1117) 评论(0) 推荐(0)
在Hibernate中使用原生SQL语句

摘要:使用原生SQL查询必须注意:程序必须选出所有的数据列才可被转换成持久化实体。假设实体在映射时有一个<many-to-one../>的关联指向另外一个实体,则SQL查询中必须返回该<many-to-one../>映射的外键列,否则将导致抛出"column not found"异常。最简单的做法是,在S 阅读全文
posted @ 2016-01-15 10:33 山高我为峰 阅读(1496) 评论(0) 推荐(0)
Project facet Java version 1.8 is not supported.

摘要:Eclipse中添加项目到Servers中时提示“Project facet Java version 1.8 is not supported.”解决方案:方法一:选中项目,右键roperties》选择 Project Facets,右击选择 Java , Change Version 即可方法二... 阅读全文
posted @ 2016-01-11 21:54 山高我为峰 阅读(1349) 评论(0) 推荐(0)
Project facet Java 1.8 is not supported by target runtime Apache Tomcat v7.0.

摘要:找到项目下的“.settings”打开“org.eclipse.wst.common.project.facet.core.xml”文件删除掉“” 阅读全文
posted @ 2016-01-09 23:25 山高我为峰 阅读(2301) 评论(0) 推荐(1)
net.paoding.analysis.exception.PaodingAnalysisException: dic home should not be a file, but a directory!

摘要:Caused by: net.paoding.analysis.exception.PaodingAnalysisException: dic home should not be a file, but a directory! at net.paoding.analysis.knife.P... 阅读全文
posted @ 2016-01-07 20:03 山高我为峰 阅读(1496) 评论(0) 推荐(0)
filter-mapping中的dispatcher使用

摘要:web.xml里中的作用 2.4版本的servlet规范在部属描述符中新增加了一个元素,这个元素有四个可能的值:即 REQUEST,FORWARD,INCLUDE和ERROR可以在一个元素中加入任意数目的,使得filter将会作用于直接从 客户端过来的request,通过forward过来的requ... 阅读全文
posted @ 2016-01-07 15:37 山高我为峰 阅读(1320) 评论(0) 推荐(0)
HQL查询语句中的模糊查询

摘要:From Person this Where this.name like '%abc%'@SuppressWarnings("unchecked") @Override public List query(String type) { return getSession... 阅读全文
posted @ 2016-01-06 16:40 山高我为峰 阅读(1620) 评论(0) 推荐(0)
将C语言的CRC32 代码转成JAVA的CRC32 代码

摘要:public class CustomerCRC32 { private static long[] crc32Table = new long[256]; static { long crcValue; for (int i = 0; i > 1; ... 阅读全文
posted @ 2016-01-05 11:35 山高我为峰 阅读(2025) 评论(0) 推荐(0)
在拼接字符串中常常因空字符串导致截取报错的技巧

摘要:String areaRange = " ";// 这里设置一个带空格的空字符串,其长度就为1,这样在下面的截取字符串时就不会因空字符报超出长度了 for (Area tempArea : areas) { ar... 阅读全文
posted @ 2015-12-23 11:57 山高我为峰 阅读(1472) 评论(0) 推荐(0)
Hibernate主键生成器

摘要:主键生成器负责生成数据表记录的主键:increment:为long,short或者int类型主键生成唯一标识。只有在没有其他进程往同一张表中插入数据时才能使用。在集群下不能使用!identity:在DB2,MySQL,Microsoft SQL Server,Sybase和HypersonicSQL... 阅读全文
posted @ 2015-12-21 17:24 山高我为峰 阅读(455) 评论(0) 推荐(0)
Spring组件扫描<context:component-scan/>使用详解

摘要:或@Component@Scope("prototype")public class TreeUtil{.....}如果不想在xml文件中配置bean,我们可以给我们的类加上spring组件注解,然后再配置下spring的扫描器就可以实现bean的自动载入。原理:Spring 2.5引入了更多典型化... 阅读全文
posted @ 2015-12-21 15:37 山高我为峰 阅读(1260) 评论(0) 推荐(0)
web.xml中contextConfigLocation参数的作用

摘要:contextConfigLocation /WEB-INF/classes/applicationContext-hibernate.xml, /WEB-INF/classes/applicationContext-service.xml, /WEB-... 阅读全文
posted @ 2015-12-21 14:44 山高我为峰 阅读(651) 评论(0) 推荐(0)
两个值相等的Integer的==比较问题

摘要:@Test public void testIntegerEqual() { /** -128~127 之外的数**/ Integer tem = 129; Integer tem1 = 129; System.out.println(tem == tem1); // false Sy... 阅读全文
posted @ 2015-12-11 11:32 山高我为峰 阅读(756) 评论(0) 推荐(0)
java 获取本机的IP地址

摘要:方法一:这种方式有一定的局限性,在Linux下的执行结果是:本机的IP = xxx/127.0.1.1 (其中xxx是你的计算机名)public void getLocalIPAddress() { try { InetAddress inetAddress = ... 阅读全文
posted @ 2015-12-04 14:58 山高我为峰 阅读(372) 评论(0) 推荐(0)
java 替换字符串中的中括号

摘要:正确方式:"[adbdesf]".replaceAll("\\[", "").replaceAll("\\]", "")错误方式:"[adbdesf]".replaceAll("[", "").replaceAll("]", "")"[adbdesf]".replaceAll("\[", "").r... 阅读全文
posted @ 2015-12-03 19:52 山高我为峰 阅读(10549) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3