`
文章列表
  javascript对xml的解析     function selectProv(field) { var xmlHttp = null; //表示当前浏览器不是ie,如ns,firefox if(window.XMLHttpRequest) {  xmlHttp = new XMLHttpRequest(); } else if (window.ActiveXObject) {  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } var url = "${pageContext.request.c ...
  java 解析xml 并导入数据库(dom4j )     import java.io.File;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.util.Iterator;import java.util.List; import org.dom4j.Document;import org.dom4j.Element;import org.dom4j.io.SAXReader; public class TestXMLImpor ...

动态代理

  JDK动态代理   public class LogHandler implements InvocationHandler {  private Object targetObject;  public Object newProxyInstance(Object targetObject) {  this.targetObject = targetObject;  return Proxy.newProxyInstance(targetObject.getClass().getClassLoader(),          targetObject.getClass().getIn ...
    HttpSessionAttributeListener 和 HttpSessionListener   1. HttpSessionAttributeListener 当session里的属性发生Add,Removed,Replaced时,tomcat会自动调用相应方法   2. HttpSessionListener 当session被create 和 Destroyed时,tomcat会自动调用相应方法  ---------------------------------------------------------------------------------- ...
表分区   1. 范围分区 create table student ( id integer not null, name varchar2(20), score integer ) partition by range(score) ( partition p1 values less than(60), partition p2 values less than(75), partition p3 values less than(85), partition p4 values less than(maxvalue) );   --------------- ...
1. 自定义converter 1) 从DefaultTypeConverter继承,重写convertValue()方法 public class MyPointConverter extends DefaultTypeConverter{       @Override     public Object convertValue(Object value, Class toType) {        if(toType == Point.class) {            Point p = new Point();            String[] strs ...
1. 自定义Interceptor //MyInterceptor.java public class MyInterceptor extends AbstractInterceptor {    public String intercept(ActionInvocation invocation) throws Exception {   long start = System.currentTimeMillis();       //Action前做点事   String r = invocation.invoke();                     //调用Acti ...
1. 声明式异常    //struts.xml <struts>        <constant name="struts.devMode" value="true"></constant>        <global-results>               <result name="error">/error.jsp</result>        </global-results>             <global-e ...
1. 输入校验       流程:用户提交表单 -> 进行类型转换(有错,转到input视图)                                  -> 输入校验validateXxxx()(有错,转到input视图)                                  -> validate()(有错,转到input视图)                                                                             如果fliedErrors里存有信息,则Action转到inpu ...
1.文件上传  //FileUpLoadAction .java public class FileUpLoadAction {  private File image;                //取得文件 private String imageFileName;      //取得文件名 private String imageContentType;   //取得文件类型   private File[] images;                //取得多个文件 private String[] imagesFileName;      //取得多个文件名 privat ...
1) struts2 tags    1.<s:property>   property: <s:property value="username"/>    //查文档,若value的类型为Object,则为OGNL表达式  property 取值为字符串: <s:property value="'username'"/> </li>  property 设定默认值: <s:property value="admin" default="管理员"/> ...

005 - OGNL

  1)OGNL (Object Graph Navigation Language)     访问值栈中的action的普通属性: username = <s:property value="username"/>   访问值栈中对象的普通属性(get set方法): <s:property value="user.age"/>                   ...
1. 取得Map类型的request,session,application   struts.xml跟普通的action的配置一样     //GetMapRequestSessionApplicationAction.java import org.apache.struts2.interceptor.ApplicationAware;import org.apache.struts2.interceptor.RequestAware;import org.apache.struts2.interceptor.SessionAware; import com.opensymph ...
1)接收参数 1. 用属性接受参数给Action    注意Action里的属性名就尽量与要传递的属性名相同 (注意不是直接给Action中的同名属性直接赋值)      如链接:     <a href="user/user!add?name=a&age=8">添加用户</a>   它用调UserAction的setName(),和setAge()方法   然后再调add()方法   相应在struts.xml中的配置:    <package name="user" extends="st ...
1)action基本配置    //IndexAction。java public class IndexAction extends ActionSupport { public String execute() {  return "success"; }}   //对应的struts.xml  <package name="front" extends="struts-default" namespace="/">      <action name="in ...
Global site tag (gtag.js) - Google Analytics