javaÖеĶ¯Ì¬´úÀí
JavaÔÚJDK1.3Ö®ºó¼ÓÈëÁË¿ÉÐÖú¿ª·¢¶¯Ì¬´úÀí¹¦ÄܵÄAPI.ʹÓö¯Ì¬´úÀí£¬¿ÉÒÔʹһ¸ö´¦ÀíÕߣ¨´úÀí£©·þÎñÓÚ¸÷¸ö¶ÔÏó¡£´´½¨Ò»¸ö¶¯Ì¬´úÀíÀàÖ»ÐèʵÏÖjava.lang.reflect.InvocationHandler½Ó¿Ú¡£
ÏÂÃæ´´½¨Ò»¸ö´¦ÀíÈÕÖ¾µÄ¶¯Ì¬´úÀíÀàLogHandlerÈ¥´úÀíHelloSpeakerÀà
Ê×ÏÈ´´½¨HelloSpeakerµÄ½Ó¿Ú
package com.test;
public interface IHello {
public void sayHello(String name);
}
È»ºó´´½¨HelloSeaker
package com.test;
public class HelloSpeaker implements IHello {
public void sayHello(String name) {
System.out.println("hello:"+name);
}
}
×îºó´´½¨LogHandlerÀà
package com.test;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.logging.Logger;
public class LogHandler implements InvocationHandler {
private Logger logger = Logger.getLogger(this.getClass().getName());
private Object delegate;
public Object bind(Object delegate) {
this.delegate = delegate;
return Proxy.newProxyInstance(delegate.getClass().getClassLoader(),
delegate.getClass().getInterfaces(), this);
}
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
Object result = null;
try {
logger.info("method start..." + method);
result = method.invoke(delegate, args);
logger.info("method end..." + method);
} catch (Exception e) {
logger.info(e.getMessage());
}
return result;
}
}
ºÃÁË£¬ÏÖÔÚÎÒÃDZàдһ¸ö²âÊÔÀàDemo
package com.test;
public class Demo {
public Demo() {
// TODO Auto-generated constructor stub
}
/**
* @param args
*/
public static void main(String[] args) {
LogHandler logHandler = new LogHandler();
&
Ïà¹ØÎĵµ£º
È¡µÃµ±Ç°ÏµÍ³Ê±¼ä System.currentTimeMillis()
·µ»ØºÁÃëʱ¼ä£¬ÎªlongÐÍÕûÊý£¬
¸Ãº¯ÊýÔÚ½øÐÐϵͳÐÔÄܼà¿Øʱ×î³£Óõ½
Àý£º
long start = System.currentTimeMillis();
//Òª¼à¿ØµÄ´úÂë¶Î
long end = System.currentTimeMillis();
System.out.println(end-start);
ÓÐʱҪ¼à¿Øµ ......
DWRʹÓÃƪ
1¡¢µ÷ÓÃûÓзµ»ØÖµºÍ²ÎÊýµÄJava·½·¨
1.1¡¢dwr.xmlµÄÅäÖÃ
Xml´úÂë
<dwr>
<allow>
<create creator="new" javascript="testClass" >
<param name="class" value= ......
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
......
(ת£ºhttp://blog.csdn.net/alex197963/archive/2008/03/26/2219994.aspx)
1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶:¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶,(URLºÍÎïÀí·¾¶)ÀýÈç:
C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶.http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶.
¡¡¡¡Ïà¶Ô·¾¶:Ïà¶ÔÓëij¸ö» ......