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

JAVA ·´Éä»úÖÆ

   Äú²éѯµÄ¹Ø¼ü´ÊÊÇ£ºnewinstance object initargs  ¡£Èç¹û´ò¿ªËÙ¶ÈÂý£¬¿ÉÒÔ³¢ÊÔ¿ìËٰ棻Èç¹ûÏë±£´æ¿ìÕÕ£¬¿ÉÒÔÌí¼Óµ½ËѲء£
(°Ù¶ÈºÍÍøÒ³http://bbs.iaiai.com/forum/read.php?tid=2690µÄ×÷ÕßÎ޹أ¬²»¶ÔÆäÄÚÈݸºÔ𡣰ٶȿìÕÕ½÷ΪÍøÂç¹ÊÕÏʱ֮Ë÷Òý£¬²»´ú±í±»ËÑË÷ÍøÕ¾µÄ¼´Ê±Ò³Ãæ¡£)
 Ö÷Ìâ : javaµÄ·´Éä»úÖÆ  ʹÓõÀ¾ß©® ¸´ÖÆÁ´½Ó ©®ä¯ÀÀÆ÷Êղة®´òÓ¡
javaµÄ·´Éä»úÖÆ
javaµÄ·´Éä»úÖÆÒ»
ÔÚjavaÀïÃæÓÐÒ»ÖÖ·´Éä»úÖÆreflect£¬ÕâÊÇÆäËüÓïÑÔËùûÓеģ¬¿ÉÒÔ¶¯Ì¬´´½¨¶ÔÏóºÍ·½·¨£¬»¹ÓгÉÔ±±äÁ¿µÈ:
Ò».¶ÔÏó¶¯Ì¬´´½¨µÄ·½·¨ÈçÏ£º
ÎÒÃÇÐèҪʹÓõÄÓÐClassÀàºÍConstructorÀà,»¹ÓÐMethodºÍFieldÀà,¾ßÌåµÄʹÓ÷½·¨ÈçÏ£º
1.ʹÓÃClassÀàµÄClass.forName(String className)·½·¨µÃµ½Ò»¸öClass¶ÔÏó£¬
eg: Class aClass=Class.forName(Foo.class.getName());
»òÕß Class aClass=Class.forName("Foo");
2.µÃµ½Ò»¸öClass¶ÔÏóÖ®ºó£¬ÎÒÃÇ»¹ÐèÒª°ÑËüת»»³ÉÎÒÃÇÐèÒªµÄÀàÐͶÔÏó£¬
eg: Foo foo=(Foo)aClass.newInstance();
×¢Òâ´ËµØ·½µÄnewInstance()·½·¨Ö»Äܵ÷ÓÃFooÀàµÄ¹«ÓÐÎ޲ι¹Ô캯Êý£¬Èç¹ûûÓй¹Ô캯Êý
ÔòʹÓø¸ÀàµÄ¹«ÓÐÎ޲ι¹Ô캯Êý£¬Èç¹û±»ÖØдÁË£¬Ôò»á´´½¨¶ÔÏóʧ°Ü¡£
3.µÃµ½Á˶ÔÏóÖ®ºóÎÒÃǾͿÉÒÔÈÎÒâ°Ú²¼ËýÁË¡£
4.Èç¹ûÎÒÃǵĹ¹Ô캯ÊýÀïÃæÐèÒª´«Èë²ÎÊý£¬Ôõô°ì£¿
ÕâʱºòÎÒÃǾÍÐèҪʹÓÃConstructorÀàÁË£¬´´½¨·½·¨ÈçÏ£º
eg: Constructor ctor = aClass.getDeclaredConstructor(Class[] parameterTypes);
Èç¹ûÎÒÃÇÓÐÕâÑùÒ»¸öÀàÐèÒª¶¯Ì¬´´½¨¶ÔÏó£º
public class BB {
private int baby = 9;
public BB(int b) {
baby = b;
}
/**
* @return Returns the baby.
*/
public int getBaby() {
return baby;
}
/**
* @param baby
* The baby to set.
*/
public void setBaby(int baby) {
this.baby = baby;
}
}
ÄÇôÎÒÃÇÈçºÎÀ´×öÄØ£¿
Integer[] os = new Integer[1];
os[0] = new Integer(6);
Class cls = Class.forName(BB.class.getName());
Constructor ctor = cls.getDeclaredConstructor((new Class[] { int.class }));
BB bbb = (BB) ctor.newInstance(os);
System.out.println(bbb.getBaby());
¶þ.·½·¨µÄ¶¯Ì¬´´½¨£º
¼ÙÉèÉÏÃæµÄBBÀàÐèÒª¶¯Ì¬´´½¨getBaby()·½·¨£¬ÎÒÃǸÃÔõô×ö£¿ÕâʱºòÎÒÃÇÐèҪʹÓõ½
MethodÀàÁË£º
1.¶¨ÒåÒ»¸ö·½·¨m:
eg: Class cls = Cla


Ïà¹ØÎĵµ£º

ÔÚjavaÖÐÓÃÊý¾Ý¿âÁ¬½Ó³ØÁ¬½ÓÊý¾Ý¿â

ºÃ¶à´óÐ͵ÄÆóÒµÏîÄ¿¶¼ÒªÓõ½¸ß¼¶JDBCÁ¬½ÓÊý¾Ý¿âÅäÖø߼¶JDBCʵÀýÈçÏ£º
µÚÒ»£ºÅäÖÃTomcatϵÄconfÎļþ¼ÐϵÄcontext.xmlÎļþ
<?xml version='1.0' encoding='utf-8'?>
<Context>
 <Resource name="jdbc/Ãû³Æ" auth="Container" type="javax.sql.DataSource"
  maxActive="10" maxIdle=" ......

3²½Ñ§»áJava Socket±à³Ì

Èý²½Ñ§»áJava Socket±à³Ì(1)
http://developer.51cto.com  2009-02-04 09:45  ØýÃû  Java8  ÎÒÒªÆÀÂÛ(0)
? ÕªÒª£ºËùνsocketͨ³£Ò²³Æ×÷"Ì×½Ó×Ö"£¬ÓÃÓÚÃèÊöIPµØÖ·ºÍ¶Ë¿Ú£¬ÊÇÒ»¸öͨÐÅÁ´µÄ¾ä±ú¡£Ó¦ÓóÌÐòͨ³£Í¨¹ý"Ì×½Ó×Ö"ÏòÍøÂç·¢³öÇëÇó»òÕßÓ¦´ðÍøÂçÇëÇó¡£±¾ÎĽ«Java Socket±à³Ì·ÖΪÈý¸öѧϰ²½Ö裬ÖðÒ ......

java¼¯³É¿ª·¢¹¤¾ßEclipseÓënetbeans±È½Ï


EclipseÓënetbeansʹÓÃÆÀ²â
½çÃæ
1 ÔÚ½çÃæÉÏnetbeans±È½ÏƯÁÁ,ÓѺá£µÃ·Ö 9
2 EclipseÓкÜÇ¿µÄ¶¨ÖÆÐУ¬Ã»netbeansÃÀ¹Û¡£ÊʺϸßÊÖ µÃ·Ö 8
¹¦ÄÜ
²»×ö±È½Ï
̸һЩ¸öÈË¿´·¨:ÔÚ¹¦ÄÜÉÏEclipseÖ§³Ö´óÁ¿µÄÀ©Õ¹,²»½ö½öÊÇÒ»¸ö java¿ª·¢¹¤¾ß,¸ü¿ÉÒÔÓÃÀ´¿ª·¢ c c++
phpµÈµÈ,¹¦ÄÜ¿ÉÒÔÎÞÏÞµÄÀ©Õ¹.netbeansÒ²Ö§³ÖÀ©Õ¹,¿ÉÒ²ÏÖÔ ......

¹ØÓÚÓÃJava³ÌÐòʵÏÖ8421ÂëȨÏÞ¹ÜÀí µÚÈý²¿·Ö

·ÖÅäÒ³ÃæRole_Right.jspÔ­Â룺
<%@ page language="java" isELIgnored="false" pageEncoding="GBK" errorPage="/inc/exception.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
 <title>½ÇÉ«·ÖÅäȨÏÞ</title>
 <!--Áбí--& ......

¹ØÓÚÓÃJava³ÌÐòʵÏÖ8421ÂëȨÏÞ¹ÜÀí µÚËIJ¿·Ö

×Ô¶¨Òå±êÇ©£¬±êÇ©´¦ÀíÆ÷Àࣺ
PrivilegeTag.JavaÓÐȨÏÞµÄÀàÉè¼Æ£º
package com.qizhi.tags.bean;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.tagext.TagSupport;
import com.qizhi.entity.Roleright;
import com.qizh ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ