java µÄÖÐ½× servlet
Rubicon
Ó¦¸Ã¾ÍÊÇ°Ñjava ÀïÃæµÄ×é¼þ¸ãÃ÷°×
Servlet
ServletÊÇÒ»ÖÖ»ùÓÚwebµÄJava×é¼þ£¬ËüÓÉÈÝÆ÷¹ÜÀí£¬²¢¶¯Ì¬Éú³ÉÆäÄÚÈÝ
ÔòûÓÐͼÐνçÃ棬ÔËÐÐÔÚ·þÎñÆ÷¶Ë
ËüÃǶ¼ÓÐÒ»¸öÉú´æÖÜÆÚ£¬°üº¬init()ºÍdestroy()·½·¨
²»ÊǶÀÁ¢µÄÓ¦ÓóÌÐò£¬Ã»ÓÐmain()·½·¨
Ó봫ͳµÄCGIºÍÐí¶àÆäËûÀàËÆCGIµÄ¼¼ÊõÏà±È£¬Java Servlet¾ßÓиü¸ßµÄЧÂÊ£¬¸üÈÝÒ×ʹÓ㬹¦ÄܸüÇ¿´ó£¬¾ßÓиüºÃµÄ¿ÉÒÆÖ²ÐÔ£¬¸ü½ÚʡͶ×Ê¡£ÔÚδÀ´µÄ¼¼Êõ·¢Õ¹¹ý³ÌÖУ¬ServletÓпÉÄܳ¹µ×È¡´úCGI
Servlet API µÄÀàºÍ½Ó¿Ú×é³ÉÁ½¸öJava °ü£¬¼´£ºjavax.servlet ºÍ javax.servlet.http
javax.servlet °üÌṩÁË¿ØÖÆ Servlet ÉúÃüÖÜÆÚËù±ØÐèµÄ Servlet ½Ó¿Ú£¬ÊDZàд Servlet ʱ±ØÐëҪʵÏÖµÄ
javax.servlet.http °üÌṩÁË´ÓServlet ½Ó¿ÚÅÉÉú³öµÄרÃÅÓÃÓÚ´¦Àí HTTP ÇëÇóµÄ³éÏóÀàºÍÒ»°ãµÄ¹¤¾ßÀà
javax.servlet.GenericServlet ºÍ javax.servlet.
http.HttpServlet ÕâÁ½¸ö³éÏóÀàµÄ×ÓÀàÀ´¼ä½ÓʵÏÖServlet ½Ó¿Ú
RequestDispatcher ½Ó¿Ú
¶¨ÒåÒ»ÖÖ¶ÔÏó£¬ÓÃÓÚ´Ó¿Í»§½ÓÊÜÇëÇ󣬲¢½«ÇëÇó·¢Ë͵½·þÎñÆ÷ÉÏÈκÎÖ¸¶¨µÄ×ÊÔ´£¬ÈçÒ»¸öServletºÍ JSP »ò HTML Îļþ
Servlet ½Ó¿Ú
¶¨ÒåÁËËùÓÐ Servlet ±ØÐëʵÏֵķ½·¨
ServletConfig ½Ó¿Ú
¶¨ÒåServletConfig¶ÔÏó£¬ÓÉServletÈÝÆ÷ÔÚ Servlet³õʼ»¯Ê±£¬ÏòServlet´«µÝÐÅÏ¢
ServletContext ½Ó¿Ú
¶¨ÒåÁËһϵÁз½·¨£¬ÒÔ±ãServletÓëÆäÔËÐеĻ·¾³Í¨ÐÅ
ServletRequest ½Ó¿Ú
¶¨ÒåÁËÓÃÓÚÏòServlet´«µÝ¿Í»§ÇëÇóÐÅÏ¢µÄ¶ÔÏó
ServletResponse ½Ó¿Ú
¶¨ÒåÁËÒ»¸ö¶ÔÏó£¬ÓÉServletÓÃÓÚÏò¿Í»§·¢ËÍÏìÓ¦
GenericServlet Àà
¼Ì³ÐServlet½Ó¿Ú£¬¶¨ÒåÁËÒ»¸öͨÓõģ¬ÓëÐÒéÎÞ
¹ØµÄServlet
ServletInputStream Àà
¶¨ÒåÁËÒ»¸öÊäÈëÁ÷£¬ÓÃÓÚÓÉServlet´ÓÖжÁÈ¡¿Í»§
ÇëÇóµÄ¶þ½øÖÆÊý¾Ý
ServletOutputStream Àà
¶¨ÒåÁËÒ»¸öÊä³öÁ÷£¬ÓÃÓÚÓÉServletÏò¿Í»§·¢ËͶþ
½øÖÆÊý¾Ý
ServletException Àà
¶¨ÒåÁËÒ»¸öµ±ServletÓöµ½ÎÊÌâʱ¿ÉÒÔÅ׳öµÄÒì³£
HttpServletRequest
À©Õ¹Á˸ýӿÚÒԺ󣬾ͿÉÒÔΪHttpServlet ÌṩÇëÇóÐÅÏ¢
HttpServletResponse
À©Õ¹¸Ã½Ó¿ÚÒԺ󣬾ͿÉÒÔΪHttpServlet Êä³öÏìÓ¦ÐÅÏ¢Ìṩ֧³Ö
HttpSession ½Ó¿Ú
Ϊά»¤HTTPÓû§µÄ»á»°×´Ì¬Ìṩ֧³Ö
Cookie ½Ó¿Ú
ÓÃÔÚServletÖÐʹÓÃCookie ¼¼Êõ
HttpServlet Àà
ÅäÖᢼ
Ïà¹ØÎĵµ£º
package com.tiantian;
import java.util.*;
public class JAVAContainer {
public static void main(String[] args) throws Exception {
// ArrayList
{
ArrayList arraylist = new ArrayList();
arraylist.add(0, "end");//Ö¸¶¨Ë÷Òý¼ÓÈëÖµ
// Ðè×¢ÒâµÄÊÇ£¬Èç¹ûÏÖÓÐ2¸öÖµ£¬ÎÒÓÈëË÷Ò?µÄÄÇô¾Í»á³öÏÖÒì³£
f ......
Èç¹û¶ÔÊý¾Ý¿â½øÐжà´Î²Ù×÷,ÿһ´ÎµÄÖ´Ðлò²½Ö趼ÊÇÒ»¸öÊÂÎñ.Èç¹ûÊý¾Ý¿â²Ù×÷ÔÚijһ²½Ã»ÓÐÖ´Ðлò³öÏÖÒì³£¶øµ¼ÖÂÊÂÎñʧ°Ü,ÕâÑùÓеÄÊÂÎñ±»Ö´ÐÐÓеľÍûÓб»Ö´ÐÐ,´Ó¶ø¾ÍÓÐÁËÊÂÎñµÄ»Ø¹ö,È¡ÏûÏÈÇ°µÄ²Ù×÷.....
JavaBeanÖÐʹÓÃJDBC·½Ê½½øÐÐÊÂÎñ´¦Àí
public int delete(int sID) {
¡¡dbc = new DataBaseConnection();
¡¡Connectio ......
±¾ÎIJÉÓÃJavaÓïÑÔд³É£¬ÒÔgoogleºÍ°Ù¶ÈËÑË÷ÒýÇæΪ¶ÔÏó¡£
ÎÒÃÇÒªÀûÓÃgoogle¡¢°Ù¶ÈËÑË÷ÒýÇæµÄËÑË÷¹æÔòÖеÄÁ½Ìõ£¬¹Ø¼ü×ÖËÑË÷ºÍinurlËÑË÷¡£Ê²Ã´ÊÇinurlËÑË÷£¬¾ÍÊÇÄãËùÒªËÑË÷µÄÍøÖ·Öб¾Éí´øÓеĹؼü×Ö£¬±ÈÈçhttp://www.xxx.com/post.asp ,Õâ¸öÍøÖ·¾Íº¬ÓÐpost.aspÕâÑùµÄ¹Ø¼ü×Ö£¬ÔÚËÑË÷ÒýÇæÖÐÌîд¹æÔòÊÇ inurl:post.asp,Õ ......
1 ×÷ÓÃÓò
javaÖÐ×÷ÓÃÓòµÄ·¶Î§ÓÉ»¨À¨ºÅ±êʾ¡£
2¹ØÓÚstatic
À¬»øÊÕ¼¯Æ÷Ö»ÖªµÀËѼ¯ÄÇЩÓÐnewÔËËã·û·ÖÅäµÄÄڴ棬²»ÖªµÀÈçºÎÊÍ·ÅÌØÊâÄÚ´æ¡£
Èç¹ûÀ¬»øÊÕ¼¯Æ÷×¼±¸»ØÊÕ¶ÔÏóµÄÄڴ棬ËüÊ×Ïȵ÷ÓÃfinalize()£¬¶øÇÒÖ»ÓÐÔÚÏÂÒ»´ÎÀ¬»øËѼ¯¹ý³ÌÖУ¬²Å»áÕæÕý»ØÊÕ¶ÔÏóµÄÄÚ´æ¡£ËùÒÔ˵Èç¹ûʹÓÃ
final ......
j2eeµÄѧϰ˳Ðò
ÎÒÈÏΪj2eeÒ»¶¨ÒªÑÐò½¥½ø£¬ÎÒ×Ô¼º¾ÍÊÇÕâÑù£¬´ÓÒ»¸öÒ»°ã¸ßУ¼ÆËã»úϵ±ÏÒµ£¬
È»ºóÂú»³ÃÎÏëºÍ¼¤ÇéÈ¥ÕÒ¹¤×÷£¬ÎÒkao,ÄǸöµ¥Î»¶¼¸øÎÒ°×ÑÛ£¬Á¬»áÀϼҵÄÐĶ¼ÓÐÁË£¬ÄǸöʱºòºÍ¼¸¸ö¸çÃÇ£¬×¡ÔÚµØÏÂÊÒ£¨¾ÍÔÚ±±º½ÄÇÀ¡£»·¾³Ï൱¶ñÁÓ£¬Å®ÅóÓÑÌìÌì´ßÎÒÕÒ¹¤×÷£¬ÎÒƨ¶¼²»»á£¬ÔõôÕÒ?Á¬ËÀµÄÐĶ¼ÓÐÁË£¨²»ÖªµÀ´ó¼ÒÓÐûÓÐÕ ......