2012 年文章归档
共 50 篇文章
Struts2+Spring3+Hibernate4整合之Maven配置文件
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/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>SSH</groupId> <artifactId>s2s3h4</artifact…
2012-12-25 11:01 · Maven
Struts2+Spring3+Hibernate4整合之Spring配置文件
applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="h…
2012-12-25 10:53 · Spring
TOAD常用快捷键
F8 调出以前执行的sql命令 F9 执行全部sql Ctrl+t 补全table_name Ctrl+. 补全table_name alt+箭头上下 看sql history Ctrl+Enter 直接执行当前sql Ctrl+Shift+F 格式化sql语句
2012-12-24 15:22 · IDE
Hibernate getCurrentSession() vs openSession()
1、getCurrentSession()与openSession()的区别 * 采用getCurrentSession()创建的session会绑定到当前线程中,而采用openSession() 创建的session则不会 * 采用getCurrentSession()创建的session在commit或rollback时会自动关闭,而采用openSession()创建的session必须手动关闭 2、使用getCurrentSession()需要在hibernate.cfg.xml文件中加入如下配置: * 如果使用的是本地事务(jdbc事务) <property name="hibern…
2012-12-21 12:30 · ORM
Tomcat 配置
${TOMCAT6_HOME}\conf\server.xml ... <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/> ... ${TOMCAT6_HOME}\conf\tomcat-users.xml ... <role rolename="manager"/> <role rolename="admin"/> <user password="admin" roles="admin,manager" username=…
2012-12-18 16:59 · Server
PL/SQL Exception Example
一个PL/SQL程序的错误可以分为两种:编译时刻错误、运行时刻错误。 编译时刻错误 由于用户输入(如表名拼写错误)、能力(语法格式错误)等方面的原因而造成的程序方面的错误就是编译时的错误。这些错误在编译时会被PL/SQL编译器发现。也可以查询数据字典USER_ERRORS、ALL_ERRORS、DBA_ERRORS来读取错误信息。 运行时刻错误 即便是通过了编译的PL/SQL程序在运行时刻还是可能产生错误的。导致运行时错误的原因很多,如内存用尽、硬件故障、违反表的完整性约束、设计上的缺陷、被0除、数字或值在长度大小方面不匹配等。 在程序内部不需要对编译时错误做特殊处理。而运行时错误可能随着运…
2012-12-10 13:39 · RDBMS
PL/SQL Cursor Example
SQL语言是面向集合的,其结果一般是集合量(多条记录),而PL/SQL语言的变量一般是标量,其一组变量只能存放一条记录。所以仅仅使用变量并不能完全满足SQL语句向应用程序输出数据的要求。因为查询结果的记录数是不确定的,事先也就不知道要声明几个变量。为此,在PL/SQL中引入了游标(cursor)的概念,用游标来协调这两种不同的处理方式。 在PL/SQL块中执行select, insert, update, delete语句时,Oracle会在内存中为其分配上下文区(Context Area),即一个缓存区。游标是指向该区的一个指针,或是命名一个工作区(Work Area),或是一种结构化数据…
2012-12-07 11:16 · RDBMS
PL/SQL Flow Control Example
PL/SQL流程控制结构包括:条件控制、循环控制、顺序控制。 条件控制 IF...THEN...ENDIF结构 IF...THEN...ELSE...ENDIF结构 DECLARE v_ename VARCHAR2 (20); v_sal NUMBER (7, 2); BEGIN SELECT ename, sal INTO v_ename, v_sal FROM emp WHERE empno = &eno; DBMS_OUTPUT.put_line (v_ename || '雇员的工资' || v_sal); IF v_sal < 1000 THEN DBMS_OUTPUT.put_li…
2012-12-06 11:15 · RDBMS
PL/SQL Basic Example
1.作用域 变量的作用域是指变量的有效作用范围,它从变量声明开始,直到当前块结束。只有在其作用域范围之内,程序才能使用该变量,否则将导致编译错误。 <<block>> DECLARE v_1 VARCHAR2 (30) := 'block中的全局v1'; BEGIN DBMS_OUTPUT.put_line (v_1); <<subblock_1>> DECLARE v_1 VARCHAR2 (30) := 'subblock_1中的局部v1'; BEGIN DBMS_OUTPUT.put_line (v_1); DBMS_OUTPUT.put_line (block.v_1); END; …
2012-12-05 14:50 · RDBMS
SQL Basic Example
对Oracle 11g scott用户下的4张表进行数据查询 SET linesize 500; SET pagesize 100; DESC dept; DESC emp; DESC bonus; DESC salgrade; --基本查询 SELECT * FROM dept; SELECT * FROM emp; SELECT * FROM bonus; SELECT * FROM salgrade; SELECT deptno, dname FROM dept; SELECT DISTINCT deptno, job FROM emp; SELECT ename, hiredate …
2012-12-03 17:41 · RDBMS
Spring Module
As of Spring version 3.1, Spring comes with 20 modules, packaged into 20 JAR files. JAR File Description aop This module contains all the classes you need to use Spring’s AOP features within your application. You also need to include this JAR in your application if you plan to use other features in…
2012-09-24 14:15 · Spring
Struts2 OGNL
Person.java package org.fool.ognl; public class Person { private String name; private Dog dog; public String getName() { return name; } public void setName(String name) { this.name = name; } public Dog getDog() { return dog; } public void setDog(Dog dog) { this.dog = dog; } } Dog.java package org.f…
2012-09-17 12:31 · Struts2
Missing artifact com.sun:tools:jar:1.5.0
Problem 这主要是由于Maven导入的struts2-core引起的。 Solution Zero -vm D:\Program Files\Java\jdk1.6.0_35\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx768m -XX:MaxPermSize=256m Solution One ... <dependencies> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactI…
2012-09-16 22:33 · Maven
jQuery Essential
Notice : As of jQuery 1.7 , the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live() . 具体的例子可以查看jquery文档 http://docs.jquery.com/Main_Page 进行参考; 或访问 http://marcgrabanski.com/ 。
2012-09-15 13:20 · jQuery
jsf code completion in eclipse
当使用Eclipse或STS,开发JSF2.0应用的时候,以.xhtml格式结尾的文件,当使用代码自动补全,没有任何提示。 解决方法: 选中工程--> Alt+Enter 勾选右边的JavaServer Faces, 之后再选择下面的Further configuration available... 导入相应的JSF库,我这里选择的是Oracle提供的Mojarra 2.1.6-FCS 配置完成后
2012-09-14 10:23 · IDE
Struts 2 日期处理
1.日期格式化 demo1 <s:textfield name="contact.birthDate" label="ContactBirthDate"> <s:param name="value"> <s:date name="contact.birthDate" format="yyyy-MM-dd" /> </s:param> </s:textfield> demo2 <input type="text" value="<s:date name="contact.birthDate" format="yyyy-MM-dd" />" /> 2.使用日期控件 加入struts2-dojo-…
2012-09-10 12:47 · Struts2
Maven部署项目到Jetty
1.pom.xml <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.…
2012-09-06 23:48 · Maven
Maven部署项目到Tomcat 7
1. Tomcat Authentication %CATALINA_HOME%/conf/tomcat-users.xml ... <role rolename="admin-script"/> <role rolename="manager-gui" /> <user username="tomcat" password="tomcat" roles="manager-gui, admin-script" /> ... 为了成功执行maven 部署 我们需要开启tomcat支持 admin-script,manager-gui的权限。 admin-script:是让tomcat支持以脚本…
2012-09-05 22:35 · Maven
Hibernate Many to Many Annotation Example
1.schema.sql alter table student_course drop foreign key FKB0A3729FA6819B7; alter table student_course drop foreign key FKB0A3729FA135F25D; drop table if exists course; drop table if exists student; drop table if exists student_course; create table course (cid integer not null auto_increment, name …
2012-08-30 15:01 · ORM