Java±à³ÌËöÊ£¨4£©——JavaÀàÖе÷ÓÃServlet
Ò»¡¢JavaÖе÷ÓÃservlet˵Ã÷£º
ÎÒÃÇÓÐʱ¿ÉÄÜÐèÒªÔÚJavaÀàÖе÷ÓÃServlet´Ó¶øʵÏÖijЩÌØÊâµÄ¹¦ÄÜ£¬ÔÚJavaAPIÖÐÌṩÁËÒ»¸öURLµÄÀ࣬ÆäÖÐopenStream( )·½·¨¿ÉÒÔ´ò¿ªURLµÄÁ¬½Ó£¬²¢·µ»ØÒ»¸öÓÃÓÚ¸ÃÁ¬½Ó¶ÁÈëµÄInputStream¡£
¶þ¡¢JavaÖе÷ÓÃservletÓ¦ÓþÙÀý£º
package com.solid.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
public class TestCallServlet {
//servlet·¾¶
private static final String path = "http://localhost:8080/test/servlet/TestServlet";
/**
* ²âÊÔµ÷ÓÃservlet·½·¨
* @param args
*/
public static void main(String[] args) {
try {
URL url = new URL(path);
url.openStream();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Èý¡¢¶Áȡij¸öÒ³ÃæÔ´´úÂëµÄÓ¦ÓþÙÀý£º
package com.solid.test;
import java.io.Bu
Ïà¹ØÎĵµ£º
¡¡¡¡ËäÈ»JavaScriptÓëJavaÓнôÃܵÄÁªÏµ£¬µ«È´ÊÇÁ½¸ö¹«Ë¾¿ª·¢µÄ²»Í¬µÄÁ½¸ö²úÆ·¡£JavaÊÇSUN¹«Ë¾ÍƳöµÄÐÂÒ»´úÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ£¬ÌرðÊʺÏÓÚInternetÓ¦ÓóÌÐò¿ª·¢£»¶øJavaScriptÊÇNetscape¹«Ë¾µÄ²úÆ·£¬ÆäÄ¿µÄÊÇΪÁËÀ©Õ¹Netscape Navigator¹¦ÄÜ,¶ø¿ª·¢µÄÒ»ÖÖ¿ÉÒÔǶÈëWebÒ³ÃæÖеĻùÓÚ¶ÔÏóºÍʼþÇý¶¯µÄ½âÊÍÐÔÓïÑÔ, ËüµÄÇ°ÉíÊ ......
1¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
1.³éÏó£º
³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º
¼Ì³ÐÊÇÒ»ÖÖÁª½áÀàµÄ²ã´ÎÄ£ÐÍ£ ......
MineHeÔ´´
¿´ÁËһ϶ÔJava GUIÌÖÂÛµÄÌû×Ó£¬ËùÒÔдÁËһƪÎÄÕÂÀ´²ûÊöһϸ÷ÖÖGUI¼¼ÊõµÄÓÅÁÓ¡£
JavaÊÀ½çÖУ¬Ä¿Ç°×îÖªÃûµÄÈý´óGUI¿â·Ö±ðÊÇ£º
1¡¢AWT£¨Abstract Window Toolkit£©³éÏó´°¿Ú¹¤¾ß°ü¿â£¬°üº¬ÓÚËùÓеÄJava SDKÖÐ
2¡¢Swing¸ß¼¶Í¼Ðο⣬°üº¬ÓÚJava2 SDKÖÐ
3¡¢À´×ÔIBM Eclipse¿ªÔ´ÏîÄ¿µÄSWT£¨Standard Widget Toolk ......
/**
* µÃµ½±¾ÖÜÖÜÒ»
*
* @return yyyy-MM-dd
*/
public static String getMondayOfThisWeek() {
Calendar c = Calendar.getInstance();
int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
if (day_of_week == 0)
da ......