ITeye博客

无居之所

ymgjava · 共 10 篇文章

Spring整合JPA

[code="xml"] ${hibernate.dialect} ${hibernate.hbm2ddl.auto} ${hibernate.show_sql} ${hibernate.format_sql} [/code]

2015-11-03 15:36 · Spring · 评论(0) · Spring · JPA

Spring 2.5整合DWR 2.06

[color=red]方法一:各种配置如下[/color] [code="web.xml"] dwr-invoker org.directwebremoting.servlet.DwrServlet debug true dwr-invoker /dwr/* [/code] [code="DwrService.java"]package com.helloworld; public class DwrService { public String sayHello(String yourName) { return "Hello World " + yourName; } }[/code] …

2011-07-10 15:04 · Spring · DWR · 评论(0) · Spring · DWR

DWR出现的A request has been denied as a potential CSRF attack解决办法

学习DWR的时候,用的是DWR2.0.6版本和火狐浏览器,在做官方的Hello world 的时候,按照文档,做的如下配置: [code="web.xml"] dwr-invoker org.directwebremoting.servlet.DwrServlet debug true dwr-invoker /dwr/* [/code] [code="jsp"] [/code] 但运行时出现以下错误: [code="error"] 2011-7-8 12:42:28 org.directwebremoting.util.CommonsLoggingOutput error 严重: A re…

2011-07-08 14:02 · DWR · 评论(0) · DWR

Spring 2.5整合iBATIS 2.3并使用Spring的声明式事务管理

Spring 2.5整合iBATIS 2.3的核心配置文件beans.xml如下: [code="beans.xml"] classpath:SqlMapConfig.xml [/code]

2011-07-07 09:12 · iBATIS · Spring · 评论(0) · Spring · iBATIS

Spring报cvc-complex-type.2.3错

将Spring与iBATIS整合,在运行Demo时报发下错误: cvc-complex-type.2.3: Element 'beans' cannot have character [children], because the type's content type is element-only. Google了好大时间,在网上发现也有不少人遇到这个问题,但是没有什么确切的原因描述与解决之道。 之后竟然绝境重生,我把applicationContext.xml中所有的注释语句(有中文)全部删除,运行程序,一切正常。 很是费解,难道是中文字符引起的问题,但中文是在 中写着啊。 更让人费解…

2011-07-07 00:43 · Spring · 评论(0) · Spring

iBATIS:java.sql.SQLException: ORA-00911: invalid character

项目用到iBATIS,编码期间,程序报错,抛出异常:[code="Exception"]java.sql.SQLException: ORA-00911: invalid character[/code]检查好长时间,终于找到问题的所在,令人吐血的是,这又是一个分号引发的异常。 具体如下: [code="sql"] SELECT i.ENT_NAME AS entName, …… WHERE i.PROV_CODE=#pCode#; [/code] sql语句后面多了一个分号,删除即可。 吐血,晕菜!

2011-07-04 22:11 · iBATIS · 评论(3) · iBATIS

iBATIS,一个空格引发的NestedSQLException异常

近日,做项目用到了iBATIS,coding期间,遇到一个问题,iBATIS抛出NestedSQLException异常,捣腾好长时间,终于找到问题所在,令人吐血的是:这是“一个空格引发的异常”。 具体如下: [code="sql"] select * from orders …… …… [/code] [color=red]*号与from之间的空格,原本是半角的,但是我不小心打成全角的了。[/color] [code="sql"] select * from orders …… …… [/code] 由此,引发出了一场“血案”。

2011-07-03 22:32 · iBATIS · 评论(1) · iBATIS

dom4j格式化xml文件

dom4j格式xml并输出为 .xml文件 * public static void main(String[] args) { Document document = DocumentHelper.createDocument(); Element employees=document.addElement("employees"); Element employee=employees.addElement("employee"); Element name= employee.addElement("name"); name.setText("jim"); Element sex=em…

2011-07-03 21:03 · dom4j · 评论(0) · Dom4j

显示iBATIS执行的SQL语句的方法

使用log4j,修改log4j的配置文件,配置如下内容: # Set root logger level to DEBUG and its only appender to CONSOLE. log4j.rootLogger=WARN,CONSOLE # CONSOLE log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.Patte…

2011-07-02 00:03 · iBATIS · 评论(1) · iBATIS

JavaScript 编码转换

JavaScript中的编码方法: escape() 方法: MSDN JScript Reference中如是说: The escape method returns a string value (in Unicode format) that contains the contents of . All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with %xx encoding, where xx is equivalent to the hexa…

2011-07-01 21:23 · JavaScript · 评论(0) · JavaScript