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

java elÅäÖúÍʹÓÃ


Ê×ÏÈÈ·¶¨ÓõÄServlet / JSPµÄ°æ±¾¡£
²é¿´web.xmlµÄ¿ªÍ·²¿·Ö£¬Èç¹ûÓÐÒÔÏÂÄÚÈÝ£¬±íʾÊÇServlet 2.4 / JSP 2.0¡£
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
ÔÚĬÈÏÇé¿öÏ£¬Servlet 2.4 / JSP 2.0Ö§³Ö¡£
Èç¹ûÊDZðµÄ°æ±¾Ï£¬½«Óõ½EL ±í´ïʽµÄ JSPÒ³ÃæµÄ¿ªÍ·Ìí¼ÓÈçÏÂÒ»¾ä´úÂë¼´¿É¡£
<%@ page isELIgnored="false" %> £¨Õâ¸öÎÒÊÔ¹ýÓÐÓã©
Ò»¡¢EL¼ò½é
1.Óï·¨½á¹¹
${expression}
2.[]Óë.ÔËËã·û
EL Ìṩ.ºÍ[]Á½ÖÖÔËËã·ûÀ´´æÈ¡Êý¾Ý¡£
µ±Òª´æÈ¡µÄÊôÐÔÃû³ÆÖаüº¬Ò»Ð©ÌØÊâ×Ö·û£¬Èç.»ò?µÈ²¢·Ç×Öĸ»òÊý×ֵķûºÅ£¬¾ÍÒ»¶¨ÒªÊ¹Óà []¡£ÀýÈ磺
${user.My-Name}Ó¦µ±¸ÄΪ${user["My-Name"] }
Èç¹ûÒª¶¯Ì¬È¡ÖµÊ±£¬¾Í¿ÉÒÔÓÃ[]À´×ö£¬¶ø.ÎÞ·¨×öµ½¶¯Ì¬È¡Öµ¡£ÀýÈ磺
${sessionScope.user[data]}ÖÐdata ÊÇÒ»¸ö±äÁ¿
3.±äÁ¿
EL´æÈ¡±äÁ¿Êý¾ÝµÄ·½·¨ºÜ¼òµ¥£¬ÀýÈ磺${username}¡£ËüµÄÒâ˼ÊÇÈ¡³öijһ·¶Î§ÖÐÃû³ÆΪusernameµÄ±äÁ¿¡£
ÒòΪÎÒÃDz¢Ã»ÓÐÖ¸¶¨ÄÄÒ»¸ö·¶Î§µÄusername£¬ËùÒÔËü»áÒÀÐò´ÓPage¡¢Request¡¢Session¡¢Application·¶Î§²éÕÒ¡£
¼ÙÈç;ÖÐÕÒµ½username£¬¾ÍÖ±½Ó»Ø´«£¬²»ÔÙ¼ÌÐøÕÒÏÂÈ¥£¬µ«ÊǼÙÈçÈ«²¿µÄ·¶Î§¶¼Ã»ÓÐÕÒµ½Ê±£¬¾Í»Ø´«null¡£
ÊôÐÔ·¶Î§ÔÚELÖеÄÃû³Æ
Page PageScope
Request RequestScope
Session SessionScope
Application ApplicationScope
¶þ¡¢ELÒþº¬¶ÔÏó
1.Ó뷶ΧÓйصÄÒþº¬¶ÔÏó
Ó뷶ΧÓйصÄEL Òþº¬¶ÔÏó°üº¬ÒÔÏÂËĸö£ºpageScope¡¢requestScope¡¢sessionScope ºÍapplicationScope£»
ËüÃÇ»ù±¾ÉϾͺÍJSPµÄpageContext¡¢request¡¢sessionºÍapplicationÒ»Ñù£»
ÔÚELÖУ¬ÕâËĸöÒþº¬¶ÔÏóÖ»ÄÜÓÃÀ´È¡µÃ·¶Î§ÊôÐÔÖµ£¬¼´getAttribute(String name)£¬È´²»ÄÜÈ¡µÃÆäËûÏà¹ØÐÅÏ¢¡£
ÀýÈ磺ÎÒÃÇҪȡµÃsessionÖд¢´æÒ»¸öÊôÐÔusernameµÄÖµ£¬¿ÉÒÔÀûÓÃÏÂÁз½·¨£º
session.getAttribute("username") È¡µÃusernameµÄÖµ£¬
ÔÚELÖÐÔòʹÓÃÏÂÁз½·¨
${sessionScope.username}
2.ÓëÊäÈëÓйصÄÒþº¬¶ÔÏó
ÓëÊäÈëÓйصÄÒþº¬¶ÔÏóÓÐÁ½¸ö£ºparamºÍparamValues£¬ËüÃÇÊÇELÖбȽÏÌرðµÄÒþº¬¶ÔÏó¡£
ÀýÈçÎÒÃÇҪȡµÃÓû§µÄÇëÇó²ÎÊýʱ£¬¿ÉÒÔÀûÓÃÏÂÁз½·¨£º
request.getParameter(String name)
request.getParameterValues(String


Ïà¹ØÎĵµ£º

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

JAVA³õѧÕß±ØÖª

 
1.     Java Ô´ÎļþÖÐ×î¶àÖ»ÄÜÓÐÒ»¸öpublicÀà,¶øÇÒÕâ¸öÀàµÄÀàÃûÒªºÍÎļþÃûÒ»ÖÂ.ÆäËûÀàµÄ¸öÊý²»ÏÞ¡£
2.    ÃæÏò¶ÔÏó³ÌÐòÉè¼ÆµÄÌØÕ÷£¨·â×°ÐÔ£©£¨¼Ì³Ð£©£¨¶à̬ÐÔ£©
3.    ½Ó¿ÚÊÇÓÉ£¨³éÏó·½·¨£©ºÍ£¨³£Á¿£©×é³ÉµÄÌØÊâÀà
4.    ÓÃstaticÐÞÊεķ½·¨Ê ......

java Ïß³Ìͬ²½

     Java ÊÇÒ»ÃÅÖ§³Ö¶àÏ̵߳ĵÄÓïÑÔ£¬µ«ÔÚ´¦Àí¶àÏß³ÌʼþʱÎÒÃDZØÐë×¢ÒâÕâÑùÒ»¸öÎÊÌ⣺¶à¸öÏ߳̿ÉÄÜͬʱ¶Ôͬһ¶ÔÏóµÄÐ޸ġ£Èç¹ûÎÒÃDz»¼°Ê±×÷³ö´¦Àí£¬¿ÉÄÜÒýÆð¶ÔÏóÖµµÄ»ìÂÒ¡£Æäʵ´¦Àí°ì·¨Ò²ºÜ¼òµ¥£¬¾ÍÊǵ±Ò»¸öÏ̴߳¦ÀíÒ»¸ö¶ÔÏó£¬Ëøס¸Ã¶ÔÏó¡£ ......

JAVA³£ÓÃÀàµÄʹÓ÷½·¨

JAVA³£ÓÃÀàµÄʹÓ÷½·¨
£±¡¢IntegerÀà
£²¡¢FloatÀà
£³¡¢DoubleÀà
£´¡¢CharacterÀà
£µ¡¢StringÀà
£¶¡¢StringTokenizerÀà
£·¡¢StringBufferÀà
£¸¡¢RandomÀà
1£®IntegerÀàµÄʹÓ÷½·¨
Interger£ºÕûÊýÀàÐÍ
£±¡¢ÊôÐÔ¡£
static int MAX_VALUE£º·µ»Ø×î´óµÄÕûÐÍÊý£»
static int MIN_VALUE£º·µ»Ø×îСµÄÕûÐÍÊý£»
static C ......

Java¿ª·¢ÕßÐè¼áÊصÄÊ®´ó»ù±¾×¼Ôò¡¾×ª¡¿

 Ò»¡¢Îª´úÂë¼Ó×¢ÊÍ¡£ËäȻÿ¸öÈ˶¼ÖªµÀÕâµã£¬µ«ÓÐʱȴ²»×Ô¾õÍüÁËÂÄÐУ¬½ñÌìÄã“ÍüÁË”¼Ó×¢ÊÍÁËÂð£¿ËäÈ»×¢ÊͶԳÌÐòµÄ¹¦ÄÜûʲô“¹±Ï×”£¬µ«¹ýÒ»¶Îʱ¼ä£¬±ÈÈç˵Á½ÐÇÆÚÖ®ºó»òÕ߸ü³¤£¬»Ø¹ýÍ·À´¿´¿´×Ô¼ºµÄ´úÂ룬˵²»¶¨ÒѾ­¼Ç²»×¡ËüÊǸÉʲôµÄÁË¡£Èç¹ûÕâЩ´úÂëÊÇÄã¸öÈ˵ģ¬ÄÇ»¹ËãÊÇ×ßÔËÁË£¬²»ÐÒµÄÊÇ£¬µ± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ