Java EE 6 Platform ½éÉÜ
Part 2£ºWeb²ã¹¦ÄÜÔöÇ¿
ÔÚJavaEE6ÖУ¬Web²ãÓÐÏÔÖøµÄ¹¦ÄÜÔöÇ¿¡£ÈçÉÏÎÄËùÊö£¬JavaaEE6ƽ̨µÄÄ¿±êÖ®Ò»¾ÍÊÇÔöÇ¿Æä¿ÉÀ©Õ¹ÐÔ£¬¶øÓë¿ÉÀ©Õ¹ÐÔÏà¹ØµÄÁ½¸ö¹Ø¼ü¼¼Êõ±ãÊÇ£ºWebƬ¶Ï£¨web fragments£©¡¢¹²Ïí¿ò¼Ü¿É²å°ÎÄÜÁ¦£¨shared framework pluggability£©£¬¶øÕâÁ½¸öÐÂÌØÐÔÊÇÓÉservlet3.0¼¼Êõ×é¼þÌṩµÄ¡£Servlet 3.0, JSR 315
ÊÇservlet¼¼ÊõµÄ×îа汾£¬ËüÌṩÁËÆäËüһЩÖØÒªµÄ¹¦ÄÜÔöÇ¿£¬ÀýÈ磺Òì²½´¦ÀíÖ§³Ö£¨asynchronous processing£©¡¢±ê×¢Ö§³Ö£¨annotations£©µÈ¡£
ÁíÍ⣬ÔÚJavaEE6ƽ̨Web²ãÖÐÖØÒªµÄ¼¼Êõ»¹ÓÐJSF2.0£¬ÕâÊÇJSF¼¼ÊõµÄ×îа汾£¬Ëü´øÀ´µÄÔöÇ¿ÊÇ£ºÍ¨¹ýFaceletsÔÚ¼òµ¥Ò³Ãæ´´½¨×é¼þ¡¢Ìí¼ÓAjaxÖ§³Ö£¬ÒÔ¼°¶Ô±ê×¢£¨annotations£©µÄÖ§³Ö¡£
servlet3.0ÖеÄWebƬ¶Î
WebÓ¦ÓóÌÐò¿ª·¢ÈËÔ±¾³£ÔÚËûÃǵijÌÐòÖÐʹÓõÚÈý·½¿ò¼Ü£¬È磺Apache Wicket »òÕß Spring MVC£¬ÒªÊ¹ÓÃÕâЩ¿ò¼Ü£¬¿ª·¢ÈËÔ±ÐèÒªÔÚWebÓ¦ÓóÌÐòÖГע²á”¸Ã¿ò¼Ü£¬Ëùν“×¢²á”ÊÇÖ¸°´Ìض¨·½Ê½½øÐÐÅäÖã¬ÀýÈçÉùÃ÷servlet ºÍ listener£¨¼àÌýÆ÷£©Àà¡£µäÐ͵Ä×ö·¨ÊÇÔÚWebÓ¦ÓóÌÐòµÄ²¿ÊðÃèÊöÎļþ——web.xmlÖнøÐÐÅäÖ㬸ÃÎļþÖаüº¬Á˹¹³ÉÓ¦ÓóÌÐòµÄWeb×é¼þµÄ²¿ÊðÃèÊö
·û
¡£Õâ²»½ö»á²úÉúÒ»¸ö·Ç³£´óµÄweb.xmlÎļþ£¬¶øÇÒÎÞ·¨¶ÀÁ¢¸ôÀë¶ÔÓÚµÚÈý·½¿ò¼ÜµÄ²¿ÊðÃèÊö
·û£¬
´Ó¶øʹ³ÌÐò±äµÃÄÑÒÔά»¤¡£
WebƬ¶Î£¬ÊÇServlet3.0¼¼ÊõµÄÐÂÌØÐÔ£¬Ëü±»ÓÃÀ´½â¾öÒÔÉÏÎÊÌâ——Ä£¿é»¯²¿ÊðÃèÊö·û¡£¿ÉÒÔ°ÑWebƬ¶Î¿´³ÉÊÇweb.xmlÎļþµÄÒ»¸öÂß¼²¿·Ö£¬¿ÉÒÔÓжà¸öWebƬ¶Î£¬Ã¿Ò»¸ö´ú±íÒ»¸ö¶ÀÁ¢µÄÂß¼²¿·Ö£¬×îÖÕÕâЩWebƬ¶Î¼¯ºÏ£¬±»¹¹½¨³ÉÒ»¸öÍêÕûµÄweb.xmlÎļþ¡£ÕâÖÖ¶Ôweb.xmlµÄ¹¹³É×é¼þ½øÐÐÂß¼·ÖÀ룬ʹµÃµÚÈý·½¿ò¼Ü¿ÉÒÔÏòWebÈÝÆ÷×ÔÐÐ×¢²á¡£ÄãÔÚWebÓ¦ÓóÌÐòÖÐʹÓõÄÿһ¸ö¿ò¼Ü£¬¶¼ÔÚÒ»¸ö¶ÀÁ¢µÄWebƬ¶Î£¨Îļþ£©Öж¨ÒåËüÐèÒªµÄ×é¼þ——Èçservlet¡¢listener£¬²»ÐèÒªÔÚweb.xmlÎļþÖб༻òÌí¼ÓÐÅÏ¢¡£
ÏÂÃæÊÇÒ»¸öWebƬ¶ÎµÄʾÀý£¬Ëü×¢²áÒ»¸öservlet¡¢Ò»¸ölistener£º
<!--
WebƬ¶ÎʹµÃµÚÈý·½Web¿ò¼Ü¿ÉÒÔ×Ô¶¯×¢²á£¬ÎÞÐèÄãͨ¹ý²¿ÊðÃèÊö·û£¨¼´web.xmlÎļþ£©È¥×¢²áËüÃÇ¡£
-->
<web-fragment>
<servlet>
<servlet-name>myFrameworkServlet</servlet-name>
<servlet-class>myFramework.myFrameworkServlet</servlet-class>
</servlet>
<listener>
<listener-class>myFramework.myFrameworkLis
Ïà¹ØÎĵµ£º
Introduction to XML and XML With Java
If you are looking for sample programs to parse a XML file using DOM/SAX parser or looking for a program to generate a XML file please proceed directly to programs.
This small tutorial introduces you to the basic concepts of XML and using Xer ......
/**
* ÏÂÔØÎļþ
* @param filePath --ÎļþÍêÕû·¾¶
* @param response --HttpServletResponse¶ÔÏó
*/
public static void downloadFile(
String filePath,
javax.servlet.http.HttpServletResponse response) {
String fileName = ""; //ÎļþÃû£¬Êä³öµ½Óû§µÄÏÂÔضԻ°¿ò
//´ÓÎļþÍêÕû·¾¶ÖÐÌáÈ¡ÎļþÃû£¬²¢½øÐбà ......
Java 3DËäÈ»ÄÜÖ§³ÖÖÚ¶àµÄÍⲿ3DÄ£ÐÍÎļþ£¬µ«ÄÜÖ§³Ö±»Java 3DʹÓõÄÍⲿģÐÍÎļþ½öΪ.objºÍ.lwdÁ½ÖÖ£»·Ö±ð¶ÔÓ¦ObjectFileÀàºÍLw3dLoaderÀà¡£Ïà±È֮ϼ¸¿îÖ÷Á÷µÄ3D½¨Ä£Èí¼þ¶¼ÄÜÉú³É.obj¸ñʽµÄÎļþ£¬Òò´Ë±¾ÎÄÖ÷Òª½éÉÜʹÓÃObjectFileÀàÔØÈë.objÎļþµÄ·½·¨¡£
ObjectFileÀàÓÐÈý¸ö¹¹Ôì·½·¨£¬·Ö±ðΪ£º
ObjectFile()
ObjectFile( ......
ǰЩÈÕ×ÓÕÛÌÚµÄÔÚÏßÅÄÕÕ£¬ÓÉÓÚÖ»ÊǸüÐÂblob×ֶΣ¬Ã»ÓÐÔÚ±¾µØ±£´æÕÕƬ£¬µ¼Ö¿ͻ§ÅÄÄÔÃÅÏëÒªµÄʱºò²»ÄÜÂíÉÏÄóöÀ´¡£Ã»ËµµÄËÈù˿ÍÊÇÉϵÛÄØ£¬×ö°É¡£Ê¹ÓÃÏ̳߳ش´½¨Èý¸öÏß³ÌÈÃ×Ô¶¨Ò»¸öÏß³ÌÄ¿±ê¹²Ïí£¨Ò²¾ÍÊǰѱíÀïµÄ¼Ç¼·Ö³Én×éͬʱִÐе¼³ö£©¡£³ÌÐòºÜ¼òµ¥£¬Ò»¹²ËĸöÀàºÍÒ»¸öojdbc14.jar°ü¡£ÓÉÓÚsqlÓï¾äд´íÁËÔì³É¶à¸öÏ̶߳ÔÒ»¸ ......
µÚ1Õ JavaÓïÑÔ¸ÅÊö
1.1 ֪ʶ¸ÅÀ¨
1.2 ʵÑéÁ·Ï°
1.2.1 Ò»¸ö¼òµ¥µÄÓ¦ÓóÌÐò
classÀï²»ÄÜÔÙÓÐclass£¬ÎÞÂÛÓÐûÓÐpublicÐÞÊΣ¬class¶¼ÊÇƽÐйØϵ£¬ÔÚbinÎļþ¼ÐÖлá²úÉú¸÷×ÔµÄ×Ö½ÚÂëÎļþ¡£Í¬Ò»¸ö.javaÔ´ÎļþÖÐÖÁ¶àÓÐÒ»¸öpublic class£¬Èç¹û²»ÏëÔÙÒ»¸öÔ´ÎļþÖÐд¶à¸öÀ࣬¾Í¸÷×ÔдԴ³ÌÐò£¬²¢°ÑÀ๫Ó㬼´ÓÃpublicÐÞÊΡ£
1.2.2 ......