´«ÖDz¥¿Íjavaѧϰ JunitºÍlog4jµÄʹÓÃ
ÎÒ½ñÌìѧϰÁË£¬Ê¹ÓÃjunit½øÐе¥Ôª²âÊÔµÄ֪ʶºÍʹÓÃlog4j½øÐÐÈÕÖ¾¹ÜÀíµÄ֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
Junit
JUnitÊÇÒ»¸ö¿ª·¢Ô´´úÂëµÄJava²âÊÔ¿ò¼Ü£¬ÓÃÓÚ±àдºÍÔËÐпÉÖظ´µÄ²âÊÔ¡£ËûÊÇÓÃÓÚµ¥Ôª²âÊÔ¿ò¼ÜÌåϵxUnitµÄÒ»¸öʵÀý£¨ÓÃÓÚjavaÓïÑÔ£©¡£Ëü°üÀ¨ÒÔÏÂÌØÐÔ£º
1¡¢ÓÃÓÚ²âÊÔÆÚÍû½á¹ûµÄ¶ÏÑÔ£¨Assertion£©
2¡¢ÓÃÓÚ¹²Ïí¹²Í¬²âÊÔÊý¾ÝµÄ²âÊÔ¹¤¾ß
3¡¢ÓÃÓÚ·½±ãµÄ×éÖ¯ºÍÔËÐвâÊԵIJâÊÔÌ×¼þ
4¡¢Í¼ÐκÍÎı¾µÄ²âÊÔÔËÐÐÆ÷
JUnit 4 ʹÓà Java 5 ÖеÄ×¢½â£¨annotation£©£¬ÒÔÏÂÊÇJUnit 4 ³£Óõļ¸¸ö annotation ½éÉÜ
@Before£º³õʼ»¯·½·¨
@After£ºÊÍ·Å×ÊÔ´
@Test£º²âÊÔ·½·¨£¬ÔÚÕâÀï¿ÉÒÔ²âÊÔÆÚÍûÒì³£ºÍ³¬Ê±Ê±¼ä
@Ignore£ººöÂԵIJâÊÔ·½·¨
@BeforeClass£ºÕë¶ÔËùÓвâÊÔ£¬Ö»Ö´ÐÐÒ»´Î£¬ÇÒ±ØÐëΪstatic void
@AfterClass£ºÕë¶ÔËùÓвâÊÔ£¬Ö»Ö´ÐÐÒ»´Î£¬ÇÒ±ØÐëΪstatic void
Ò»¸öJUnit 4 µÄµ¥Ôª²âÊÔÓÃÀýÖ´ÐÐ˳ÐòΪ£º
@BeforeClass –> @Before –> @Test –> @After –> @AfterClass
ÿһ¸ö²âÊÔ·½·¨µÄµ÷ÓÃ˳ÐòΪ£º
@Before –> @Test –> @After
log4j
ʹÓÃlog4j¿ÉÒÔ½øÐÐÈÕÖ¾¹ÜÀí£¬
1. Log4JÊÇApacheµÄÒ»¸ö¿ª·ÅÔ´´úÂëÏîÄ¿£¬ËüÊÇÒ»¸öÈÕÖ¾²Ù×÷°ü£¬Í¨¹ýʹÓÃLog4J£¬¿ÉÒÔÖ¸¶¨ÈÕÖ¾ÐÅÏ¢Êä³öµÄÄ¿µÄµØ£¬Èç¿ØÖÆ̨¡¢Îļþ¡¢£Ã£Õ£É×é¼þ¡¢NTµÄʼþ¼Ç¼Æ÷£»»¹¿ÉÒÔ¿ØÖÆÿһÌõÈÕÖ¾Êä³ö¸ñʽ¡£´ËÍ⣬ͨ¹ý¶¨ÒåÈÕÖ¾ÐÅÏ¢µÄ¼¶±ð£¬Äܹ»·Ç³£Ï¸ÖµؿØÖÆÈÕÖ¾µÄÊä³ö£¬×îÁîÈ˸ÐÐËȤµÄÊÇ£¬ÕâЩ¹¦ÄÜ¿ÉÒÔͨ¹ýÒ»¸öÅäÖÃÎļþÀ´Áé»î½øÐÐÅäÖ㬶ø²»ÐèÒªÐÞ¸ÄÓ¦³ÌÐò´úÂë¡£
ÔÚÓ¦ÓóÌÐòÖÐÊä³öÈÕÖ¾ÓУ³¸öÄ¿µÄ£º
l ¼àÊÓ´úÂëÖбäÁ¿µÄ±ä»¯Çé¿ö£¬°ÑÊý¾ÝÖÜÆÚÐԼǼµ½ÎļþÖй©ÆäËûÓ¦ÓýøÐÐͳ¼Æ·ÖÎö¹¤×÷
l ¸ú×Ù´úÂëÔËÐÐʱ¹ì¼££¬×÷ΪÈÕºóÉó¼ÆµÄÒÀ¾Ý
l µ£µ±¼¯³É¿ª·¢»·¾³Öеĵ÷ÊÔÆ÷µÄ×÷Óã¬ÏòÎļþºÍ¿ØÖÆ̨´òÓ¡´úÂëµÄµ÷ÊÔÐÅÏ¢
ÒªÔÚ³ÌÐòÖÐÊä³öÈÕÖ¾£¬×îÆÕͨµÄ×ö·¨¾ÍÊÇÔÚ´úÂëÖÐǶÈëÓï¾ä£¬ÕâЩ´òÓ¡Óï¾ä¿ÉÒÔ°ÑÈÕÖ¾Êä³öµ½¿ØÖÆ̨»òÎļþÖУ¬±È½ÏºÃµÄ×ö·¨¾ÍÊǹ¹ÔìÒ»¸öÈÕÖ¾²Ù×÷ÀàÀ´·â×°´ËÀà²Ù×÷£¬¶ø²»ÊÇÈÃһϵÁеĴòÓ¡Óï¾ä³ä³â´úÂëµÄÖ÷Ìå¡£
2. ÔÚÇ¿µ÷¿ÉÖØÓÃ×é¼þµÄ½ñÌ죬³ýÁË×Ô¼º´ÓÍ·µ½Î²¿ª·¢Ò»¸ö¿ÉÖØÓõÄÈÕÖ¾²
Ïà¹ØÎĵµ£º
public class Bean1 {
private String strValue;
private int intValue;
private List listValue;
private Set setValue;
private String[] arrayValue;
private Map mapValue;
public String getStrValue() {
return strValue;
}
public void setStrValue(String strValue) {
t ......
1 package ºÍ importµÄ×÷ÓÃÊÇ·Ö¸îÈ«¾ÖÃüÃû¿Õ¼ä£¬±£Ö¤ÎÒÃDz»»áÓöµ½Ãû×ֵijåÍ»¡£
2 java½âÊÍÆ÷µÄ¹¤×÷³ÌÐò£º
£¨1£© Ê×ÏÈËüÕÒµ½»·¾³±äÁ¿CLASSPATH £¬ CLASSPATH°üº¬Ò»¸ö»ò¶à¸öĿ¼£¬ËüÃÇ×÷Ϊһ¸öÌØÊâµÄ¸ùʹÓ㬴ÓÕâÀïÕ¹¿ª¶Ô.classÎļþµÄËÑË÷£¬
´ÓÄǸö¸ù¿ªÊ¼£¬½âÊÍÆ÷»áÑ°ÕÒ°üÃû£¬²¢½«ËüÃÇÿһ¸öµãºÅ ......
´ÓJavaSE µ½JavaEE
ÔÙ´Ócorejava1,corejava11,Java Language Specification, Second(Third) Edition, Think in java£¬Data Structure java depth Adventrue)
תµ½JavaEE(EJB,Spring,Hibernate,Webwork,struts1,strut2,jsp,servlet)
´Ó¿ªÔ´×éÖ¯ÔÙµ½×Ô×éÖ¯£¬ÔÙµ½corejava1,corejava11
µ½JavaWebServer,java Web Prog ......
1. doGet vs doPost
Õâ¸öÎÊÌ⣬ÀÏʦ½²µÃ²»ÊǺÜÇåÎú£¬½ö½ö½²ÁËdoGetÊÇ¿ÉÒÔÈ¡³ö²ÎÊýÖµÔÚurlÖеIJÎÊý¡£ÒÔÏÂÄÚÈÝcopy×ÔÍøÂ磺
“getÖ»ÓÐÒ»¸öÁ÷£¬²ÎÊý¸½¼ÓÔÚurlºó£¬µØÖ·ÐÐÏÔʾҪ´«Ë͵ÄÐÅÏ¢£¬´óС¸öÊýÓÐÑϸñÏÞÖÆÇÒÖ»ÄÜÊÇ×Ö·û´®¡£
postµÄ²ÎÊýÊÇͨ¹ýÁíÍâµÄÁ÷´«µÝµÄ£¬ ²»Í¨¹ýurl£¬ËùÒÔ¿ÉÒԺܴó£¬Ò²¿ÉÒÔ´« ......
µ±ÖØÔØequals·½·¨Ê±,×ñѹßÀý. equals²»ÊÇÿ¸öÀ඼±ØÐëÖØÔØ,µ±ÒÔϼ¸¸öÌõ¼þÂú×ã,¿ÉÒÔ²»ÖØÔØequals. 1. ÀàµÄʵÀýÖ»ÓÐͬһ¸ö²Å±»ÅÐΪÏàµÈ. ÈçThreadÀà. 2. ²»ÓùØÐÄÁ½¸ö¶ÔÏóÊÇ·ñÂß¼ÏàµÈµÄʱºò,»òÊÇ˵±È½Ï¶ÔÏóûÓÐÒâÒå. 3.¸¸ÀàÒѾÖØÔØÁËequals,¶øÇÒ¸¸ÀàµÄequalsÒ²ÊÊÓÃÓÚ×ÓÀà,×ÓÀà¾Í²»ÓÃÖØÔØequals. 4.ÕâÊÇÒ»¸ö˽ÓÐÀà»òÊ ......