`
awfrun
  • 浏览: 82027 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论
文章列表
之所以会写这个程序完全是因为偷懒^^,那时在公司实习要我们用jdbc来写练习,想想已经很久没用过纯的jdbc来写操作数据库了,用Hibernate多好啊,最少也可以用ibatis,想到那么SQL语句就烦,写来写去都是那几句。那时刚好学过反射和注解所以就决定自己写一个ORM框架,当然只是简单的那种,刚开始用到了apache下的开源项目dbutils,不过后来就慢慢的改进用反射来代替,虽然现在那用到这个包,关键部分还是用反射实现的.   核心类:   package com.permission.utils.db; import java.lang.reflect.Field; impo ...

struts2 类型转换

1.默认转换,大多情况我们使用默认的就可以了,      日期类型,输入xx?d=2010-05-24,   action中的d,  private Date d;   页面取值: <s:date name="d" format="yyyy/MM/dd HH:mm:ss"/>    数组类型:     输入:xx?list=one&list=two    action中:List<String> list;  //Set 也一样    页面取值:<s:property value="lis ...
1. 首先在提交的form表单加入<s:token></s:token> 2.修改struts.xml    <action name="user" class="com.awf.action.UserAction">   <result>/addOK.jsp</result>    <interceptor-ref name="defaultStack"></interceptor-ref>   <interceptor-ref name ...
1.  自定义拦截类 implements  Interceptor实现里面的方法 import com.opensymphony.xwork2.ActionInvocation;import com.opensymphony.xwork2.interceptor.Interceptor; public class MyInterceptor implements  Interceptor {  public void destroy() {  // TODO Auto-generated method stub   }  public void init() {  // TODO Au ...
 1. property: <s:property value="username"/>  2. property 取值为字符串: <s:property value="'username'"/>  3.  property 设定默认值: <s:property value="admin" default="管理员"/>  4. property 设定HTML: <s:property v ...
<?xml version="1.0" encoding="GB18030" ?> <%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ taglib uri="/struts-tags" prefix="s" %> <!DOCTYPE html PUBLIC &qu ...
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMod ...
1.DefaultAction,一般用在请求不存在时,默认跳转到defaultAction,例如主页 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <s ...
下面介绍4种访问request,session,application的方法: 第一种:依赖于容器 import java.util.Map; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.validator.annotations.Validations; public class LoginAction1 extends ActionSupport{ private ...
一般form对象有时会和model对象有一样的属性,就算不同也只是多几个元素,在form对象里我们可以这样做, import org.apache.struts.action.ActionForm; import com.awf.model.Pay; public class PayForm extends ActionForm{ private Pay pay = new Pay(); private String name; get/set.... public P ...
import java.util.List; import org.springframework.dao.DataAccessException; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class ObjectDao extends HibernateDaoSupport { // condition为条件,查询一组数据,该方法的返回类型为Object public Object getObjectForm(String hql) { List ...

日志工具类

    博客分类:
  • java
import org.apache.log4j.Logger; public class LogUtil { private static Logger logger = Logger.getLogger(LogUtil.class);  public LogUtil(){}   public static void debug(String message){  logger.debug(message); }  public static void debug(String message,Throwable t){  logger.debug(message,t); }  public ...

获取时间的类

    博客分类:
  • java
import java.util.Calendar; public class GetSystemTime { private Calendar now = Calendar.getInstance(); private int year = now.get(Calendar.YEAR); private int month = now.get(Calendar.MONTH) + 1; private int day = now.get(Calendar.DAY_OF_MONTH); public String getToday() { String toda ...
public class UserAction extends ActionSupport { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public String add2(){ if(name==null || !name.equals("admin")){ this.addFieldError("na ...
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMod ...
Global site tag (gtag.js) - Google Analytics