ITeye博客

ati000

AAries · 共 18 篇文章

ExtDirectSpring的用法一

环境搭建好以后。就可以在Ext中调用controller中的方法了。 第一步 页面上的引入 dispatcher/api-debug.js中的dispatcherw为web.xml中配置的映射 groupe=reg 为组 用来区分是哪个action的哪个方法 在js文件中需要引入Ext.direct.Manager.addProvider(Ext.app.REMOTING_API); 3.掉用方法 //调用了Verify下的verifyName()方法 handler: function() { var values = regForm.getForm().getValues(); // v…

2011-09-26 20:40 · ExtJS · 评论(0)

ExtDirectSpring的配置过程

6.配置ExtDirectSpring的过程: 1. 配置spring3MVC . 需要在web.xml中加入spring的配置信息大致如下: <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> 2.配置映射关系 <servlet-mapping> <servlet-name>dispatc…

2011-09-26 19:47 · Ext Spring Direct · 评论(2)

ConcurrentModificationException异常的原因

jdk5.0以上的for-each也是利用内部的iterator来遍历集合的(跟以前的iterator一样)获得的Iterator是一个内部类产生的迭代器,这个迭代器在调用next方法时,会检查列表是否被修改过,如果被修改过,就会抛出ConcurrentModificationException异常。 进一步说,当使用 fail-fast iterator 对 Collection 或 Map 进行迭代操作过程中尝试直接修改 Collection / Map 的内容时,即使是在单线程下运行,java.util.ConcurrentModificationException 异常也将被抛出。I…

2011-08-16 19:45 · java · 评论(0)

byte[]数组的转换

public class DataFormatConvertUtil { /** * Static method, a long type data into a byte array of specified length * * @return byte[] */ public static byte[] intToByteArray(long res, int length) { byte[] byteArray = new byte[length]; for (int i = 0; i < byteArray.length; i++) { byteArray[i] = (byte) …

2011-08-16 19:30 · byte[]数组转换 · 评论(0)

RTU

最近项目分给我一个任务模拟写RTU的客户端程序,和一个产品的用户手册,所以没怎么更新。现在对这 段时间接触到的东西做个总结。 打开页面时显示为下载页面。看到一个同事出这个错误。结果是头文件没写好 <%@page contentType="text/html" pageEncoding="GB2312"%>少了分号。 设置JTable的列数。 DefaultTableModel tableModel = (DefaultTableModel) Table.getModel(); tableModel.setRowCount(clientArray.size()); 在使用SocketChann…

2011-08-16 19:26 · 经验 · 评论(0)

SocketChannel

1.SocketChannel 客户端与 ServerSocketChannel 服务器端通信 2.客户端使用SocketChannel的connect方法连接服务器时,服务器会收到一个可接受的包。建立连接,同时在此时设置下一次的包是可读或是可写等等。 3.如果服务器端指定为可读,而客户端指定为可写,会出异常。反之亦然。 4.如果在服务器端为指定下次接受的包的读写性,则既不会读也不会写。 5.在读buffer前必须flip(); 遍历一个selectionkey集合。 e.g. SocketChannel sk = (SocketChannel)SelectionKey.channel();…

2011-08-08 19:28 · Java基础知识 · 评论(0)

SocketChannel使用心得

1.服务器端while(true) 一直等待client端来连接。 基本步骤为: ServerSocketChannel server = ServerSocketChannel.open(); server.configureBlocking(false); server.socket().bind(new InetSocketAddress(5200)); Selector select = Selector.open(); server.register(select, SelectionKey.OP_ACCEPT); 声明一个等待客户端的服务器。 select.select(); S…

2011-08-03 19:07 · Java基础知识 · 评论(1)

ServerSocketChannel

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package mailclass; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.ch…

2011-08-03 18:52 · Java基础知识 · SocketChannel · ServerSocketChannel · 评论(0)

SocketChannel服务器端

package mailclass; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.nio.charset.Charset; import java.util.Iterator; /** * * @author AAries zyz! */ public class Client…

2011-08-03 18:48 · SocketChannel · 评论(0)

Java题

1. public class LastLaugh{ public static void main(String args) { System.out.print("H" + "a"); System.out.print('H' + 'a'); } } 注释:开始以为是+号当string处理的考点,就答了HaHa。失策啊。忘记了 + 是String 类重载的方法。当一个String类的对象和另外一个非String类的对象 + 时。非String类的对象会装换成String类对象来处理。所以本题的答案是Ha169。a的ASK码为97,97-32+7+97 = 169! 2. public c…

2011-08-02 20:14 · Java基础知识 · 评论(0)

线程池例子(实现统计指定目录下面包含关键字文件的多少)

package threadpooltest; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import ja…

2011-07-28 17:43 · Java基础知识 · 评论(0)

阻塞队列例子(实现指定目录下查找包含关键字的文件)

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package blockingqueuetest; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.concurrent.ArrayBlockingQueue; import jav…

2011-07-28 17:41 · Java基础知识 · 评论(0)

Java基础知识学习

I am not happy. God bless me. 1.线程。新建一个线程的方法是extends Thread类。重写run方法。或者implements Runable接口。实现run方法。线程的方法: a.void join() //等待终止指定的线程 b.void join(long millis) c.Tread.State getState() d.void setPrority(int new Prority) e.static int MIN_PRIORITY d.static void yield; 2.锁机制。java.util.concurrent.locks.l…

2011-07-28 17:37 · Java基础知识 · 评论(0)

Java基础知识学习5

How are you doing? 比较正式的说法!最近怎么样。 what's happening? 发生了什么事情。 comparable :接口。implements comparable接口的话,则必须实现compareTo方法。将这个对象 this与另一个对象进行比较! java.util.Comparator 接口下有一个Compara(T a, T b),将对象a和对 象b进行比较。 队列与双端队列:队列可以有效的在尾部添加一个元素,在头部删除一个元素!有两个断头的队列成为 双端队列! 3.优先级队列PriorityQu eue:元素可以按照任意的顺序插入,却总按照排序的顺序进…

2011-07-27 19:59 · Java基础知识 · 评论(0)

Java基础知识学习4

good luck!i hope wyp can love me than I love her! now pratice the english. happiness lies not in the mere possession money, it lies in the joy of achievement, in the thrill of creative effort. hinder:打扰,阻扰。 hinred:继承 genic:泛型,通常。一般 Modifier,java语言的修饰符号,public private等。 Class类的方法。getConstructors(Cla…

2011-07-26 19:55 · Java基础知识 · 评论(0)