java Ḭ̈߳²È«
Servlet/JSP¼¼ÊõºÍASP¡¢PHPµÈÏà±È£¬ÓÉÓÚÆä¶àÏß³ÌÔËÐжø¾ßÓкܸߵÄÖ´ÐÐЧÂÊ¡£ÓÉÓÚServlet/JSPĬÈÏÊÇÒÔ¶àÏß³ÌģʽִÐеģ¬ËùÒÔ£¬ÔÚ±àд´úÂëʱÐèÒª·Ç³£Ï¸Öµؿ¼ÂǶàÏ̵߳ݲȫÐÔÎÊÌ⡣Ȼ¶ø£¬ºÜ¶àÈ˱àдServlet/JSP³ÌÐòʱ²¢Ã»ÓÐ×¢Òâµ½¶àḬ̈߳²È«ÐÔµÄÎÊÌ⣬ÕâÍùÍùÔì³É±àдµÄ³ÌÐòÔÚÉÙÁ¿Óû§·ÃÎÊʱûÓÐÈκÎÎÊÌ⣬¶øÔÚ²¢·¢Óû§ÉÏÉýµ½Ò»¶¨ÖµÊ±£¬¾Í»á¾³£³öÏÖһЩĪÃ÷ÆäÃîµÄÎÊÌâ¡£
¡¡¡¡ServletµÄ¶àÏ̻߳úÖÆ
¡¡
¡¡¡¡ServletÌåϵ½á¹¹Êǽ¨Á¢ÔÚJava¶àÏ̻߳úÖÆÖ®Éϵģ¬ËüµÄÉúÃüÖÜÆÚÊÇÓÉWebÈÝÆ÷¸ºÔðµÄ¡£µ±¿Í»§¶ËµÚÒ»´ÎÇëÇóij¸öServletʱ£¬ServletÈÝÆ÷½«»á¸ù¾Ýweb.xmlÅäÖÃÎļþʵÀý»¯Õâ¸öServletÀà¡£µ±ÓÐеĿͻ§¶ËÇëÇó¸ÃServletʱ£¬Ò»°ã²»»áÔÙʵÀý»¯¸ÃServletÀ࣬Ҳ¾ÍÊÇÓжà¸öÏß³ÌÔÚʹÓÃÕâ¸öʵÀý¡£ServletÈÝÆ÷»á×Ô¶¯Ê¹ÓÃÏ̳߳صȼ¼ÊõÀ´Ö§³ÖϵͳµÄÔËÐУ¬Èçͼ1Ëùʾ¡£
ͼ1 ServletÏ̳߳Ø
¡¡¡¡ÕâÑù£¬µ±Á½¸ö»ò¶à¸öÏß³Ìͬʱ·ÃÎÊͬһ¸öServletʱ£¬¿ÉÄܻᷢÉú¶à¸öÏß³Ìͬʱ·ÃÎÊͬһ×ÊÔ´µÄÇé¿ö£¬Êý¾Ý¿ÉÄÜ»á±äµÃ²»Ò»Ö¡£ËùÒÔÔÚÓÃServlet¹¹½¨µÄWebÓ¦ÓÃʱÈç¹û²»×¢ÒâḬ̈߳²È«µÄÎÊÌ⣬»áʹËùдµÄServlet³ÌÐòÓÐÄÑÒÔ·¢ÏֵĴíÎó¡£
¡¡¡¡ServletµÄḬ̈߳²È«ÎÊÌâ
¡¡¡¡ServletµÄḬ̈߳²È«ÎÊÌâÖ÷ÒªÊÇÓÉÓÚʵÀý±äÁ¿Ê¹Óò»µ±¶øÒýÆðµÄ£¬ÕâÀïÒÔÒ»¸öÏÖʵµÄÀý×ÓÀ´ËµÃ÷¡£
Import javax.servlet. *;
Import javax.servlet.http. *;
Import java.io. *;
Public class Concurrent Test extends HttpServlet {PrintWriter output;
Public void service (HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {String username;
Response.setContentType ("text/html; charset=gb2312");
Username = request.getParameter ("username");
Output = response.getWriter ();
Try {Thread. sleep (5000); //ΪÁËÍ»³ö²¢·¢ÎÊÌ⣬ÔÚÕâÉèÖÃÒ»¸öÑÓʱ
} Catch (Interrupted Exception e){}
output.println("̞:"+Username+"<BR>");
}
}
¡¡¡¡¸ÃServletÖж¨ÒåÁËÒ»¸öʵÀý±äÁ¿output£¬ÔÚservice·½·¨½«Æ丳ֵΪÓû§µÄÊä³ö¡£µ±Ò»¸öÓû§·ÃÎʸÃServletʱ£¬³ÌÐò»áÕý³£µÄÔËÐУ¬µ«µ±¶à¸öÓû§²¢·¢·ÃÎÊʱ£¬¾Í¿ÉÄÜ»á³öÏÖÆäËüÓû§µÄÐÅÏ¢ÏÔʾÔÚÁíÍâһЩÓû§µÄä¯ÀÀÆ÷ÉϵÄÎÊÌâ¡£ÕâÊÇÒ»¸öÑÏÖصÄÎÊÌ⡣ΪÁËÍ»³ö²¢·¢ÎÊÌ⣬±ãÓÚ²âÊÔ¡¢¹Û²ì£¬ÎÒÃÇÔÚ»ØÏÔÓû§ÐÅϢʱִÐÐÁËÒ»¸öÑÓʱµÄ²Ù×÷¡£¼ÙÉèÒÑÔÚweb.xmlÅäÖÃÎļþÖÐ×¢²áÁ˸ÃServlet£¬ÏÖÓÐÁ½¸öÓû§aºÍbͬʱ·
Ïà¹ØÎĵµ£º
ÀûÓÃJava Reflect»úÖƱàдÍòÄÜtoString()·½·¨:
package com.accp.test.filed;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
publ ......
¹ØÓÚjavaµÄÁ´±í˼Ïë
ÏÈ¿É¿´ÒÔÏÂÀý×Ó
ÏȽ¨Á¢Ò»¸öʵÀý(Student.java)
package com.yz.mylink;
public class Student {
private Integer id;
private String name;
private Integer age;
private String classes;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = i ......
Java ÖÐÄÚ²¿¶¯Ì¬Àà(ûÓÐstatic)¹Ø¼ü×ÖºÍÄÚ²¿¾²Ì¬ÀàµÄ¾ÍÔÚÓÚÄÚ²¿¶¯Ì¬À಻Äܶ¨Ò徲̬±äÁ¿»òÊǾ²Ì¬·½·¨,Èç¹ûÒªÔÚÄÚ²¿ÀàÖÐʹÓþ²Ì¬³ÉÔ±,±ØÐ뽫ÀàÉùÃ÷Ϊ¾²Ì¬Àà. ÄÚ²¿ÀàÖеľ²Ì¬·½·¨¿ÉÒÔ·ÃÎÊÍⲿÀàµÄ¾²Ì¬·½·¨ºÍ±¾ÀàÖеľ²Ì¬·½·¨»ò³ÉÔ±, ·Ç¾²Ì¬·½·¨¿ÉÒÔ·ÃÎÊÆäËûËùÓеķ½·¨»ò³ÉÔ± ......
ºÜ¶àʱºòÊý×é´æÔÚןܴóµÄȱÏÞ£¬Ê×ÏȱØÐëÏÈÉèÖÃÊý×éµÄ³¤¶È£¬µ±É趨ÁËÖ®ºó£¬¾ÍÎÞ·¨¸Ä±äÁË¡£
ÏÂÀ´ÊÇÒ»ÖÖÊý×鳤¶È¶¯Ì¬±ä»¯µÄÒ»ÖÖ·½·¨
package com.yz.mystack;
public class Stack {
Object[] datas;
Integer n=0;
Integer N=1;
public Stack(){
datas=new Object[N];
}
public void push(Object data){
......
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Temp {
public Temp() {
JFrame J = new JFrame("MENU");
Container C = J. ......