ITeye博客

2014 年文章归档

共 16 篇文章

在SpringMVC中如何重写Request URI

可以通过Filter来实现,Filter继承于javax.servlet.Filter,重写getRequestURI方法 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(new HttpServletRequestWrapper((HttpServletRequest) request) { @Override public String getRequ…

2014-10-29 19:22 · SpringFramework

Spring配置文件location的几种设置方法

1.默认location 默认会去加载WEB-INF下的applicationContext.xml文件,如果该文件不存在,则会抛出以下的异常。 org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open…

2014-10-23 17:14 · SpringFramework · springframework

JQuery UI的Autocomplete用法

1.下拉框中出现的是包含当前输入字母的元素 例如:当输入C时,会出现C++,coldfusion和javascript的可选项 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>autocomplete demo</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"…

2014-10-22 10:06 · JQuery · jQuery · jQuery UI

守护线程和Shutdown Hooks

线程分为两种:守护线程和用户线程(也叫非守护线程)。 可以通过Thread的setDaemon(boolean on)方法将其设定为守护线程或用户线程。 setDaemon方法必须在线程启动前被调用。不然会产生IllegalThreadStateException异常。 并且,守护线程具有传递性,即如果一个线程是守护线程,那么它的子线程也会是守护线程。 守护线程是为了服务于用户线程而存在的,所以当Java的执行环境结束(调用System.exit方法停止JVM时,或者所有非守护线程都结束时)守护线程也会退出。 有一点注意了,在application中要慎用用户线程,因为当JVM中存在aliv…

2014-09-04 17:32 · Java基础 · Java · JVM · thread

Classloader委任机制以及Tomcat中Classloader分析(整理)

参照网页 http://hi.baidu.com/qmiao128/item/c983bffca5ca6fec1b111f26 http://m.oschina.net/blog/144133 http://blog.csdn.net/feng2007110221053/article/details/7071823 Java中一共有四个类加载器,之所以叫类加载器,是程序要用到某个类的时候,要用类加载器载入内存。 这四个类加载器分别为:Bootstrap ClassLoader、Extension ClassLoader、AppClassLoader 和URLClassLoader,他们的作…

2014-09-03 22:32 · J2EE/JavaEE · JVM · Tomcat · ClassLoader

Ant中调用Main函数和Junit的测试用例

Ant中调用Junit的测试用例 <target name="test"> <delete dir="${result.dir}" /> <mkdir dir="${result.dir}" /> <junit printsummary="yes"> <classpath> <pathelement path="${classpath}"/> <pathelement location="${bin.dir}"/> </classpath> <formatter type="xml" /> <batchtest todir="${result.dir}"> <fileset dir="${b…

2014-09-03 13:59 · Ant · junit · Ant

解除Tomcat中POST方式上传文件的大小限制

当服务器是Tomcat时,通过POST上传的文件大小的最大值为2M(2097152)。 如果想修改该限制,修改方法如下: tomcat目录下的conf文件夹下,server.xml 文件中以下的位置中添加maxPostSize参数 <Connector port="8081" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disab…

2014-09-03 13:50 · J2EE/JavaEE · Tomcat

JavaScript中的window.close在FireFox和Chrome上不能正常动作的解决方法

JS中关闭窗口的方法window.close()在IE上能够正常动作,而在FireFox和Chrome上无法动作。 (当时,在Chrome35.0上的时候还是可以的,Chrome36.0上就无法动作了) FireFox上的解决方法如下(已验证) 在Firefox地址栏里输入 about:config 将配置列表中的dom.allow_scripts_to_close_windows 设为true Chrome上的解决方法有两种(这两种方法应该在FireFox上也是可行的,但未验证) 参考网页 http://stackoverflow.com/questions/2032640/problem…

2014-09-03 13:43 · Web前端编程 · JavaScript

Struts MPV(Multi Page Validation)的使用方法

需要对用户输入的信息在不同的页面进行校验时,常常会使用到Struts MPV(Multi Page Validation)机能。 假设有如下需求 用户在第一个name页面输入firstName和lastName,校验通过后点击next按钮,进入输入address的页面。 在address页面中,如果点击previous按钮,则不会对address页面进行校验,直接返回name页面。点击提交按钮,如果校验通过,则进入成功页面。 实现 要实现上述的需求,可以使用struts MPV机能来实现。 1.定义form-bean 将需要校验的所有属性都定义在此form(MPVTestForm)中,此需求…

2014-09-02 13:53 · Struts1.x · Struts

SpringData JPA详解

Spring Data JPA 1. 概述 Spring JPA通过为用户统一创建和销毁EntityManager,进行事务管理,简化JPA的配置等使用户的开发更加简便。 Spring Data JPA是在Spring JPA的基础上,对持久层做了简化。用户只需声明持久层的接口,不需要实现该接口。Spring Data JPA内部会根据不同的策略、通过不同的方法创建Query操作数据库。 2. Spring Data JPA jar文件 到目前为止,社区提供的最新的Spring Data JPA的jar文件如下: - spring-data-commons-1.8.0.RELEASE.jar…

2014-08-17 22:03 · SpringData · JPA

如何安装SolarisStudio12.3

不需要使用命令安装,只需要进行解压。 假设,解压后的路径为:/export/home/user/soft/SolarisStudio12.3… 1.在/opt下创建如下目录: /opt/SolarisStudio12.3 2.进行link, “ln –s /opt/SolarisStudio12.3 /export/home/user/soft/SolarisStudio12.3” 这样,执行/opt/SolarisStudio12.3/proc/bin/cc的时候,实际上调用的是/export/home/user/soft/SolarisStudio12.3/proc/bin/cc

2014-07-25 14:56 · Solaris

systemctl命令用法 (转)

以Apache Httpd为例 ①某服务自动启动 旧 → chkconfig --level 3 httpd on 新 → systemctl enable httpd.service ②使某服务不自动启动 旧 → chkconfig --level 3 httpd off 新 → systemctl disable httpd.service ③检查服务状态 旧 → service httpd status(服务详细信息) 新 → systemctl status httpd.service 或 journalctl -xn(服务详细信息) systemctl is-active http…

2014-07-24 15:47 · Linux · Linux

Solaris上syslog的配置

1、配置/etc/syslog.conf文件 在原始文件中的 *.err;kern.debug;daemon.notice;mail.crit /var/adm/messages 后添加local6.info,即 *.err;kern.debug;daemon.notice;mail.crit**;local6.info** /var/adm/messages 将设备local6的info级别以上的log写入到/var/adm/messages文件中 2、重启syslog服务 在 Solaris 8 和 Solaris 9 等老版本上,通过键入以下命令重新启动 syslogd: $ /etc…

2014-06-11 09:26 · Solaris · Solaris · syslog

为没有预留空间的Solaris系统制作裸设备

原始分区如下,并没有为裸设备预留空间,我们从后面的磁柱开始往前分: Part Tag Flag Cylinders Size Blocks 0 root wm 114 - 847 25.80GB (734/0/0) 54116352 1 swap wu 0 - 113 4.01GB (114/0/0) 8404992 2 backup wm 0 - 850 29.92GB (851/0/0) 62742528 我们要用一个3.5G的裸设备,3.5G/(30G/851(总磁柱数))=100,就是要使用磁柱数 为745-845的磁柱。 手顺如下: #format #format>0(0为你选择的…

2014-06-11 09:22 · Solaris · Solaris · 裸设备

为Maven自定义repository的path、修改JDK版本、自定义代理

修改文件 “maven的安装路径\conf\settings.xml” 1.自定义repository的path <localRepository>F:\maven\.m2\repository</localRepository> 2.修改JDK版本 两种方法,请参照 http://lyking2001.iteye.com/blog/837440 3.自定义代理 <proxies> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <!--<username>proxyuser</usernam…

2014-06-10 11:47 · Maven · maven · settings

SpringData JPA+topLink抛出NoSuchMethodError

我使用的jar如下: spring-data-jpa-1.6.0.RELEASE.jar spring-data-commons-1.8.0.RELEASE.jar toplink-essentials.jar toplink-essentials-agent.jar (topLink的版本是2.1) 执行时抛出如下异常: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMapppingContext': Invocation of in…

2014-06-10 11:18 · SpringFramework · SpringData · JPA · eclipselink