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

Java EE Ö®JSP

 1.¸ÅÊö
JSPÊÇÒ»ÖÖʵÏÖÆÕͨ¾²Ì¬HTMLºÍ¶¯Ì¬HTML»ìºÏ±àÂëµÄ¼¼Êõ¡£
JSP×îÖջᱻת»»³É±ê×¼µÄServlet£¡£¡£¡
JSPÉè¼ÆµÄÄ¿µÄÔÚÓÚ¼ò»¯±íʾ²ãµÄ±íʾ¡£
JSPÒ³ÃæµÄÆäËû³É·ÖÖ÷ÒªÓÐÈçÏÂÈýÖÖ£º
½Å±¾ÔªËØ
Ö¸Áî
¶¯×÷
ÀýÈ磺
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*“ %>
...
<HTML>
  <BODY>
ÆäËû HTML ÓïÑÔ
<%
  ·ûºÏJAVA Óï·¨µÄ JAVA Óï¾ä
%>
 ÆäËû HTML ÓïÑÔ
  </BODY>
</HTML>
2.Óï·¨
JSPԭʼ´úÂëÖаüº¬ÁËJSPÔªËغÍTemplate(Ä£°å) dataÁ½Àà ¡£
Template dataÖ¸µÄÊÇJSPÒýÇæ²»´¦ÀíµÄ²¿·Ö£¬¼´±ê¼Ç<%……%>ÒÔÍâµÄ²¿·Ö£¬ÀýÈç´úÂëÖеÄHTMLµÄÄÚÈÝµÈ £¬ÕâЩÊý¾Ý»áÖ±½Ó´«Ë͵½¿Í»§¶ËµÄä¯ÀÀÆ÷¡£
JSPÔªËØÔòÊÇÖ¸½«ÓÉJSPÒýÇæÖ±½Ó´¦ÀíµÄ²¿·Ö£¬ÕâÒ»²¿·Ö±ØÐë·ûºÏJSPÓï·¨£¬·ñÔò»áµ¼Ö±àÒë´íÎó¡£
JSPÓï·¨·ÖΪÈýÖÖ²»Í¬µÄÀàÐÍ
Ö¸Áî(DIRECTIVE) ÀýÈ磺 <%@ page import=“java.io.*” %>
½Å±¾Óï·¨(SCRIPTING)
¶¯×÷Óï·¨(ACTION) ÀýÈ磺 <jsp:forward>£¬<jsp:getProperty>£¬<jsp:include>
a.½Å±¾Óï·¨°üÀ¨£º
“HTML×¢ÊÍ”:<!— comments -->
JSP Óï·¨¸ñʽÈçÏ£º
<!-- comment [ <%= expression %> ] --> »ò<!-- ×¢ÊÍ [<%= ±í´ïʽ %> ] -->
ÕâÖÖ×¢ÊÍ·¢Ë͵½¿Í»§¶Ë£¬µ«²»Ö±½ÓÏÔʾ£¬ÔÚÔ´´úÂëÖпÉÒԲ鿴µ½¡£
“Òþ²Ø×¢ÊÍ”:<%-- comments --%>
JSP Óï·¨¸ñʽÈçÏ£º
  <%-- ×¢ÊÍ --%>
 ²»·¢Ë͵½¿Í»§¶Ë¡£
“ÉùÃ÷”
JSP Óï·¨¸ñʽÈçÏ£º
<%! declaration; [ declaration; ] ... %> »ò<%! ÉùÃ÷; [ÉùÃ÷; ] ... %>
“±í´ïʽ”
ÓÃÓÚÔÚÒ³ÃæÉÏÊä³öÐÅÏ¢£¬Óï·¨¸ñʽÈçÏ£º
<%= expression %> »ò<%= ±í´ïʽ %>
<%=±í´ïʽ%>Êä³ö±í´ïʽµÄ¼ÆËã½á¹û¡£±í´ïʽÖеıäÁ¿±ØÐëÊÇÇ°ÃæÒÑÉùÃ÷¹ýµÄ±äÁ¿
×¢Ò⣺£¥Ó룽֮¼ä²»ÄÜÓпոñÇÒ±í´ïʽºóÃæ²»ÐèÒª·ÖºÅ¡£
“½Å±¾¶Î”
JSP Óï·¨¸ñʽÈçÏ£º
<% code fragment %> »ò<% ´úÂë %>
b.Ö¸ÁîÔªËØÓï·¨£º
JSPÖ¸ÁîÊÇ´ÓJSPÏòWebÈÝÆ÷·¢Ë͵ÄÏûÏ¢£¬ËüÓÃÀ´ÉèÖÃÒ³ÃæµÄÈ«¾ÖÊôÐÔ£¬ÈçÊä³öÄÚÈÝÀàÐ͵ȡ£
×¢Ò⣺ָÁîµÄ×÷Ó÷¶Î§½öÏÞÓÚ°üº¬Ö¸Áî±¾ÉíµÄJSPÒ³Ãæ¡£
JSPµÄÖ¸Áî¸ñʽΪ£º<%@ Ö¸ÁîÃû ÊôÐÔ="ÊôÐ


Ïà¹ØÎĵµ£º

²»µÃ²»¿´µÄJava¼¼ÇÉ:SE6µ÷ÓñàÒëÆ÷µÄ·½·¨

ÔںܶàJavaÓ¦ÓÃÖÐÐèÒªÔÚ³ÌÐòÖе÷ÓÃJava±àÒëÆ÷À´±àÒëºÍÔËÐС£µ«ÔÚÔçÆڵİ汾ÖУ¨Java SE5¼°ÒÔÇ°°æ±¾£©ÖÐÖ»ÄÜͨ¹ýtools.jarÖеÄcom.sun.tools.javac°üÀ´µ÷ÓÃJava±àÒëÆ÷£¬µ«ÓÉÓÚtools.jar²»ÊDZê×¼µÄJava¿â£¬ÔÚʹÓÃʱ±ØÐëÒªÉèÖÃÕâ¸öjarµÄ·¾¶¡£¶øÔÚJava SE6ÖÐΪÎÒÃÇÌṩÁ˱ê×¼µÄ°üÀ´²Ù×÷Java±àÒëÆ÷£¬Õâ¾ÍÊÇjavax.tools°ü¡£Ê¹ÓÃÕ ......

java enum ½²½â

Ô­ÎĵØÖ·:http://www.javaeye.com/topic/477731
°æȨÉùÃ÷£ºËùÓаæȨ¹éÔ­×÷ÕßËùÓÐ
ö¾ÙÀàÐÍÊÇJDK5.0µÄÐÂÌØÕ÷¡£SunÒý½øÁËÒ»¸öȫеĹؼü×ÖenumÀ´¶¨ÒåÒ»¸öö¾ÙÀà¡£ÏÂÃæ¾ÍÊÇÒ»¸öµäÐÍö¾ÙÀàÐ͵Ķ¨Ò壺
Java´úÂë
public enum Color{   
    RED,BLUE,BLACK,YELLOW,GREEN  &nb ......

Java³£ÓÃÕýÔò±í´ïʽ

java³£ÓÃÕýÔò±í´ïʽ
Ö»ÄÜÊäÈëÊý×Ö£º"^[0-9]*$"¡£
Ö»ÄÜÊäÈënλµÄÊý×Ö£º"^\d{n}$"¡£
Ö»ÄÜÊäÈëÖÁÉÙnλµÄÊý×Ö£º"^\d{n,}$"¡£
Ö»ÄÜÊäÈëm~nλµÄÊý×Ö£º¡£"^\d{m,n}$"
Ö»ÄÜÊäÈëÁãºÍ·ÇÁ㿪ͷµÄÊý×Ö£º"^0|[1-9][0-9]*$"¡£
Ö»ÄÜÊäÈëÓÐÁ½Î»Ð¡ÊýµÄÕýʵÊý£º"^[0-9]+( ......

ÈçºÎÀûÓÃjavaµÃµ½µ±Ç°µÄʱ¼äºÍÇ°Ò»ÌìµÄʱ¼ä

1.µÃµ½µ±Ç°µÄʱ¼ä
Calendar cal = Calendar.getInstance();
String time=formatter.format(cal.getTime());
String strEnd=time.substring(0, 16);// 2007-10-30 09:30
Calendar cal = Calendar.getInstance();
String time=formatter.format(cal.getTime());
String strEnd=time.subst ......

cÖкÍjavaÖÐÊý×éµÄÇø±ð

  ¶ÔÓÚÔ­ÓïÀàÐ͵ÄÊý×飬Èçint[]   a,ÔÚCÀïÃæÖ»ÒªÕâÑù¶¨ÒåÖ®ºó¾Í¿ÉÒÔÓÃa[i]ʹÓÃÁË£¬µ«ÊÇÔÚJAVAÀïÃæÊDz»Ðеģ¬±ØÐëÓÃint[]   a   =   new   int[LENGTH];À´ÎªÊý×é·ÖÅä¿Õ¼ä¡£ÕâÀïµÄa¸üÓ¦¸Ã¿´³ÉCÀïÃæµÄÖ¸Õ룬ËüºÍCÀïÃæµÄint*   aÊÇÒ»ÑùµÄ£¬ÒòΪÕâ¸öa£¨CÀïÃæµÄ£©Ò²ÒªÏÈmallocÒ»¸ö¿Õ¼äÖ®ºó²Å¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ