Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java¶¯Ì¬´úÀí

 
¶¯Ì¬´úÀíÊÇÖ¸¿Í»§Í¨¹ý´úÀíÀàÀ´µ÷ÓÃÆäËü¶ÔÏóµÄ·½·¨
¶¯Ì¬´úÀíʹÓó¡ºÏ:

Ô¶³Ì·½·¨µ÷ÓÃ(RMI)

 
1.´´½¨Ò»¸öʵÏÖ½Ó¿ÚInvocationHandlerµÄÀ࣬Ëü±ØÐëʵÏÖinvoke·½·¨
2.´´½¨±»´úÀíµÄÀàÒÔ¼°½Ó¿Ú
3.ͨ¹ýProxyµÄ¾²Ì¬·½·¨
newProxyInstance(ClassLoader loader, Class[] interfaces, InvocationHandler h) ´´½¨Ò»¸ö´úÀí
4.ͨ¹ý´úÀíµ÷Ó÷½·¨
 
²Î¼û³ÌÐòVectorProxy.java
 
package com.langsin.dynamicproxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.List;
import java.util.Vector;
public class VectorProxy implements InvocationHandler
{
private Object proxyobj;
public VectorProxy(Object obj)
{
proxyobj = obj;
}
public static Object factory(Object obj)
{
Class<?> cls = obj.getClass();
return Proxy.newProxyInstance(cls.getClassLoader(),
cls.getInterfaces(), new VectorProxy(obj));
}
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
{
System.out.println("before calling " + method);
if (args != null)
{
for (int i = 0; i < args.length; i++)
{
System.out.println(args[i] + "");
}
}
Object object = method.invoke(proxyobj, args);
System.out.println("after calling " + method);
return object;
}
@SuppressWarnings("unchecked")
public static void main(String[] args)
{
List<String> v = (List<String>) factory(new Vector<String>(10));
v.add("New");
v.add("York");
System.out.println(v);
v.remove(0);
System.out.println(v);
}
}

²Î¼û³ÌÐòFoo.java
²Î¼û³ÌÐòFooImpl.java
²Î¼û³ÌÐòFooImpl2.java
²Î¼û³ÌÐòCommonInvocationHandler.java
²Î¼û³ÌÐòDemo.java
package com.langsin.dynamicproxy;
public interface Foo
{
void doAction();
}
package com.langsin.dynamicproxy;
public class FooImpl implements Foo
{
public FooImpl()
{
}
public void doAction()
{
System.out.println("in FooImp1.doActio


Ïà¹ØÎĵµ£º

JAVAÖг£ÓÃÓ¢Îļòдȫƴ¼°ÖÐÎĺ¬Òå

×òÌì¿´ÕÅТÏéµÄjava¸ß¼¶½Ì³Ì£¬Ëû˵һ°ëÃæÊÔjavaÖÐÓ¢ÎļòдÒâ˼µÄ¶¼ÊÇһЩ´ó¹«Ë¾£¬Ò»¸ö¿¼²ìÄãÕæµÄÓùýÕâЩ¶«Î÷£¬È·Êµ¶ÔÕâЩ¶«Î÷Óиö»ù±¾Á˽⣬ͬʱÐèÒªÄã¾ßÓÐÒ»¶¨µÄÓ¢Óïˮƽ¡£ËùÒÔÔÝʱ²¹²¹¿Î£¬ºÇºÇ¡£
API (Application Programming Interface) Ó¦Óñà³Ì½Ó¿Ú
JRE (Java Runtime Enviroment) Java ÔËÐÐʱ»·¾³
JDK (Java Dev ......

Javaѧϰ֮·

1£®ÈçºÎѧϰ³ÌÐòÉè¼Æ£¿
JAVAÊÇÒ»ÖÖƽ̨£¬Ò²ÊÇÒ»ÖÖ³ÌÐòÉè¼ÆÓïÑÔ£¬ÈçºÎѧºÃ³ÌÐòÉè¼Æ²»½ö½öÊÊÓÃÓÚJAVA£¬¶ÔC++µÈÆäËû³ÌÐòÉè¼ÆÓïÑÔÒ²Ò»Ñù¹ÜÓá£Óбà³Ì¸ßÊÖÈÏΪ£¬ JAVAÒ²ºÃCÒ²ºÃûʲô·Ö±ð£¬ÄÃÀ´¾ÍÓá£ÎªÊ²Ã´ËûÃÇÄÜ´ïµ½Èç´Ë¾³½ç£¿ÎÒÏëÊÇÒòΪ±à³ÌÓïÑÔÖ®¼äÓй²Í¨Ö®´¦£¬Áì»áÁ˱à³ÌµÄ¾«Ë裬×ÔÈ»Äܹ»×öµ½Ò»Í¨°Ùͨ¡£ÈçºÎѧϰ³ÌÐòÉè¼ÆÀ ......

JAVA¶ÔÏóת»»ÎªXML¸ñʽ

JAVA¶ÔÏóת»»ÎªXML¸ñʽ
    ¼òµ¥µÄ²üÊöÏÂÈçºÎ½«JAVA¶ÔÏóת»»ÎªXML¸ñʽ£¬ÏêϸÁ˽âÇë½øÈëhttp://xstream.codehaus.org/tutorial.html
  
 JAVABEAN¶ÔÏó
 
  userInfo.java
         private String name;
   & ......

java servlet

×î½ü£¬Éî¿ÌµÄÈÏʶµ½£¬ ѧϰ£¬²»½öÒª¶à¿´Ê飬»¹ÒªÊ±²»Ê±µÄ×ܽáһϣº
     ÓÃJSP + Servlet + JavaBean¿ª·¢ÏîÄ¿£¬ Ô­ÒÔΪÊDZȽÏÔã¸âµÄÊ£¬ ÒòΪ£¬JSP Ò³ÃæÖÐ ×ܻᱻǶÈëºÜ¶à java´úÂ룬ÆäʵÎÒÒ»Ö±¾õµÃ£¬¼ÈÈ»ÓÐÁË strutsµÈ±íʾ²ã¿ò¼Ü£¬¾Í²»ÒªÓÃServlet À´×ö¿ØÖÆÆ÷ÁË£¬ ¿ÉÊÇ×î½ü£¬Ã÷°×ÁË£¬  ×Ð ......

ÉîÈëdz³öJavaÉè¼Æģʽ֮ÊÊÅäÆ÷ģʽ


ͨ³££¬¿Í»§Àà(clients of class)ͨ¹ýÀàµÄ½Ó¿Ú·ÃÎÊËüÌṩµÄ·þÎñ¡£ÓÐʱ£¬ÏÖÓеÄÀà(existing class)¿ÉÒÔÌṩ¿Í»§ÀàµÄ¹¦ÄÜÐèÒª£¬µ«ÊÇËüËùÌṩµÄ½Ó¿Ú²»Ò»¶¨ÊÇ¿Í»§ÀàËùÆÚÍûµÄ¡£ÕâÊÇÓÉÓÚÏÖÓеĽӿÚÌ«Ïêϸ»òÕßȱ·¦Ïêϸ»ò½Ó¿ÚµÄÃû³ÆÓë¿Í»§ÀàËù²éÕҵIJ»Í¬µÈÖî¶à²»Í¬Ô­Òòµ¼Öµġ£
¡¡¡¡ÔÚÕâÖÖÇé¿öÏ£¬ÏÖÓеĽӿÚÐèҪת»¯(convert)Ϊ¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ