- 博客(76)
- 收藏
- 关注
原创 上传图片
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> "> My JSP 'test_1.jsp' starti
2013-05-17 19:08:42 387
原创 得到request内容,并且用foreach
<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> "> My JSP 'left.jsp
2013-05-14 13:58:46 686
原创 javascript 弹出确定窗口
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> "> My JSP 'index.jsp' startin
2013-03-18 21:45:32 504
原创 传参时的中文问题
有两种方法 第一种 struts.xml <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> /register_success.jsp
2013-03-05 15:43:49 427
原创 启动web.xml时自动把beans.xml里的bean自动注入一遍
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml
2013-03-05 03:12:37 785
原创 struts2 开发模式 struts.devMode
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> /register_success.jsp /register_fail
2013-03-05 02:58:55 470
原创 把session 打开的时间延续到view这层
配一个filter openSessionInView 且一定要配置在struts2的前面 而且会默认在beans.xml 里找名为sessionfactory的factory 如果想改默认找的名字,就要 配上init-param 在里面param-value配要找的sessionfactory的名字
2013-03-03 15:52:00 185
原创 spring_hibernate_hibernateDaoSupport(1)
public class StudentDao extends HibernateDaoSupport{ public void save(User user) { this.getHibernateTemplate().save(user); } } public class StudentLog extends HibernateDaoSupport{ publi
2013-03-02 15:42:47 209
原创 spring_hibernate_hibernateTemplate:模板一种
<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.springfra
2013-03-02 15:14:21 201
原创 spring_hibernate_事务管理:xml 方式
@Repository("s_dao") public class StudentDao { private SessionFactory factory; public SessionFactory getFactory() { return factory; } @Resource public void setFactory(SessionFactory factory)
2013-03-02 14:38:33 277
原创 spring_hibernate_Transaction:事务管理
@Repository("s_dao") public class StudentDao { private SessionFactory factory; public SessionFactory getFactory() { return factory; } @Resource public void setFactory(SessionFactory factory)
2013-03-01 17:56:10 223
转载 org.objectweb.asm.ClassWriter.<init>(I)V和org.objectweb.asm.ClassWriter.<init>(Z)V
刚开始出现下面的错误 Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(Z)V。 后来换了个编译环境又出现这个错误 Invocation of init method failed; nested exception
2013-03-01 17:52:15 262
原创 spring+hibernate :annotation
User.class @Entity public class User { private int id; private String name; @Id @GeneratedValue public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName()
2013-03-01 16:14:38 165
原创 spring+datasource @Annotation方式
<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:p="http://www.s
2013-02-28 21:58:58 1166
原创 aspect advice pointcut:xml 方式
public class testAop { public void method(){} public void around(ProceedingJoinPoint p) throws Throwable { System.out.println("around begin"); p.proceed(); System.out.println("around over");
2013-02-28 21:09:25 260
原创 aspect advice pointcut :annotation 方式
@Aspect @Component public class testAop { @Pointcut("execution(* com.sl.service.*.*(..))") public void method(){} @Around("execution(public void com.sl.service.StudentService.add(com.sl.entity.Us
2013-02-28 20:42:01 1026
原创 动态代理
当被代理对象有接口的时候可以jdk动态代理技术 例子 如果StudentServiceImpl有User的时候就可以调用当中的方法,没有就不可以 public interface StudentService { public void addStudent(); } public class StudentServiceImpl implements StudentServic
2013-02-27 21:59:03 240
原创 @Component @Service @Controller @Repository
<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.springf
2013-02-27 16:55:29 438
原创 @Resource
加入:j2ee/common-annotations.jar 默认按名称(例子里如果没定义name,会自动找名字为dao的bean),名称找不到,按类型可以指定特定名称 不足:如果没有源码,就无法运用annotation,只能使用xml 代码中的xml和@autowire一样 只是写的annotation不同 public class StudentService { priva
2013-02-27 16:39:44 317
原创 annotation 中的autowire
先配置XML文件 <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://
2013-02-27 16:23:19 169
原创 alt+/ 的提示
如果再xml里标签没有提示可以在catalog配置如图 如果在编写代码的时候点(.)不出来,或者@不出来,可以在assist里配置如图 在这里的 第二个中设置
2013-02-27 16:16:56 252
原创 生命周期
a) lazy-init (不重要):就是在new 那个applicationContext的时候不会立即把对象初始化,只有当用到的时候才会初始化 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanc
2013-02-27 15:57:52 158
原创 autowire 自动匹配
public class StudentService { private StudentDao dao; public StudentDao getDao() { return dao; } public void setDao(StudentDao dao) { this.dao = dao; } public void add(User u){ dao.sav
2013-02-27 14:27:02 203
原创 Map List Set props
Collections administrator@example.org support@example.org development@example.org a list element followed by a reference
2013-02-27 14:01:30 214
原创 bean scope
singleton单例,拿的一直是同一个 <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" xsi:schema
2013-02-25 17:32:59 189
原创 简单的参数注入
public class StudentService { private String name; private int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() {
2013-02-25 17:19:15 242
原创 构造方法注入
public class StudentDao { public void save(User u){ System.out.println("save "+u.getName()+" success!"); } } public class StudentService { private StudentDao dao; public StudentService(Stu
2013-02-25 17:05:56 290
原创 helloworld set方法注入
首先写class dao public class StudentDao { public void save(User u){ System.out.println("save "+u.getName()+" success!"); } } service public class StudentService { private StudentDao dao; pu
2013-02-25 16:52:12 294
原创 result 带参数
类 public class test1 extends ActionSupport{ private int type; public int getType() { return type; } public void setType(int type) { this.type = type; } public String execute(){ return SUCCESS; }
2013-02-22 14:59:34 321
原创 dynamicsResult
test1 类 public class test1 extends ActionSupport{ private String r; public String getR() { return r; } public void setR(String r) { this.r = r; } public String A(){ System.out.println("A"); r="
2013-02-22 14:39:24 157
原创 global result
Global类 public class Global extends ActionSupport{ public String execute(){ System.out.println("this"); return SUCCESS; } public String A(){ System.out.println("A"); return "first"; } public
2013-02-22 14:23:48 273
原创 result: type
result:type 主要用到4种 redirect 重定向一个页面(地址会变) dispatcher 转载到一个页面(不变) chain 转载到一个action redirectAction 重定向到一个action /r1.jsp /r2.jsp r1
2013-02-21 16:40:25 183
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人