»ùÓÚmvcµÄjava webÉè¼ÆÓ뿪·¢
µÚ1Õ strutsÓëjava webÓ¦Óüò½é
1.1 java webÓ¦ÓøÅÊö
1.2 web×é¼þµÄÈýÖÖ¹ØÁª¹Øϵ
1.3 muv¸ÅÊö
1.4 struts¸ÅÊö
1.4.1 strutsʵÏÖmvcµÄ»úÖÆ
ÔÚstruts¿ò¼ÜÖУ¬Ä£ÐÍÓÉʵÏÖÒµÎñÂß¼µÄjavabean»òejb×é¼þ¹¹³É£¬¿ØÖÆÆ÷ÓÉ
ActionServletºÍActionÀàʵÏÖ£¬ÊÓͼÓÉÒ»×éjspÎļþ¹¹³É¡£
1.ÊÓͼ
ÊÓͼ¾ÍÊÇjspÎļþ¡£ÔÚÕâЩjspÎļþÖÐûÓÐÒµÎñÂß¼£¬Ò²Ã»ÓÐÄ£ÐÍÐÅÏ¢£¬Ö»ÓбêÇ©¡£
ͨ³£°Ñstruts¿ò¼ÜÖеÄActionForm bean Ò²»®·Öµ½ÊÓͼģ¿éÖС£struts¿ò¼ÜÀûÓÃActionForm
beanÀ´½øÐÐÊÓͼºÍ¿ØÖÆÆ÷Ö®¼ä±íµ¥Êý¾ÝµÄ´«µÝ¡£struts¿ò¼Ü°ÑÓû§ÊäÈëµÄ±íµ¥Êý¾Ý±£´æÔÚ
ActionForm beanÖУ¬°ÑËü´«µÝ¸ø¿ØÖÆÆ÷£¬¿ØÖÆÆ÷¿ÉÒÔ¶ÔActionForm beanÖеÄÊý¾Ý½øÐÐÐ޸ģ¬
jspÎļþʹÓÃstruts±êÇ©¶ÁÈ¡Ð޸ĺóµÄActionForm beanµÄÐÅÏ¢¡£ÖØÐÂÉèÖÃhtml±íµ¥¡£
2.Ä£ÐÍ
Ä£ÐͱíʾӦÓóÌÐòµÄ״̬ºÍÒµÎñÂß¼¡£ÒµÎñÂ߼ͨ³£ÓÉjavabean»òejb×é¼þÀ´ÊµÏÖ¡£
3.¿ØÖÆÆ÷
¿ØÖÆÆ÷ÓÉActionServletÀàºÍActionÀàÀ´ÊµÏÖ¡£ActionServletÀàÊÇstruts¿ò¼ÜÖеĺË
ÐÄ×é¼þ¡£ActionServlet¼Ì³ÐÁËjavax.servlet.http.HttpServletÀ࣬ËüÔÚmvcÄ£ÐÍÖаçÑÝ¿ØÖÆ
Æ÷µÄ½ÇÉ«¡£ActionServletÖ÷Òª¸ºÔð½ÓÊÕhttpÇëÇóÐÅÏ¢£¬¸ù¾ÝÅäÖÃÎļþstruts-config.xmlµÄÅä
ÖÃÐÅÏ¢£¬°ÑÇëÇóת·¢¸øÊʵ±µÄAction¶ÔÏó¡£Èç¹û¸ÃAction¶ÔÏó²»´æÔÚ£¬ActionServlet»áÏÈ´´½¨
Õâ¸öAction¶ÔÏó¡£
ActionÀฺÔðµ÷ÓÃÄ£Ð͵ķ½·¨£¬¸üÐÂÄ£Ð͵Ä״̬£¬²¢°ïÖú¿ØÖÆÓ¦ÓóÌÐòµÄÁ÷³Ì¡£¶ÔÓÚ
СÐ͵ÄÓ¦Óã¬ActionÀà±¾ÉíÒ²¿ÉÒÔÍê³ÉһЩʵ¼ÊµÄÒµÎñÂß¼¡£
¶ÔÓÚ´óÐÍÓ¦Óã¬Action³äµ±Óû§ÇëÇóºÍÒµÎñÂß¼´¦ÀíÖ®¼äµÄÊÊÅäÆ÷£¨Adaptor£©£¬Æ书ÄܾÍÊǽ«
ÇëÇóÓëÒµÎñÂß¼·Ö¿ª£¬Action¸ù¾ÝÓû§ÇëÇóµ÷ÓÃÏà¹ØµÄÒµÎñÂß¼×é¼þ¡£ÒµÎñÂß¼×é¼þÓÉ
javabean»òÕßejb×é¼þÀ´Íê³É£¬ActionÀà²àÖØÓë¿ØÖÆÓ¦ÓóÌÐòµÄÁ÷³Ì£¬¶ø²»ÊÇʵÏÖÓ¦ÓóÌÐòµÄÂß
¼¡£Í¨¹ý½«ÒµÎñÂß¼·ÅÔÚµ¥¶ÀµÄjava°ü»òejbÖУ¬¿ÉÒÔÌá¸ßÓ¦ÓóÌÐòµÄÁé»îÐԺͿÉÖØÓÃÐÔ¡£
µ±ActionServlet¿ØÖÆÆ÷ÊÕµ½Óû§ÇëÇóºó£¬°ÑÇëÇóת·¢µ½Ò»¸öActionʵÀý¡£Èç¹ûÕâ¸öʵ
Àý²»´æÔÚ£¬¿ØÖÆÆ÷»áÊ×ÏÈ´´½¨Ëü£¬È»ºóµ÷ÓÃActionʵÀýµÄexecute£¨£©·½·¨¡£ActionµÄexecute
£¨£©·½·¨·µ»ØÒ»¸öActionForward¶ÔÏó£¬Ëý·â×°ÁË°ÑÓû§ÇëÇóÔÙת·¢¸øÆäËûweb×é¼þµÄÐÅÏ¢¡£ÓÃ
»§¶¨Òå×Ô¼ºµÄActionÀ࣬¼´Action»ùÀàµÄ×ÓÀàʱ£¬±ØÐ븲¸Çexecute£¨£©·½·¨¡£ÔÚAction»ùÀàÖÐ
¸Ã·½·¨·µ»Ønull¡£
1.4.2 strutsµÄ¹¤×÷Á÷³Ì
µ±ActionServlet½ÓÊÕµ½Ò»¸ö¿Í»§µÄÇëÇóʱ£¬½«Ö´ÐÐÈçÏÂÁ÷³Ì£º
1.¼ì
Ïà¹ØÎĵµ£º
ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1 List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......
ÔõôѧϰJava£¬ÕâÊǺܶàÐÂÊÖ¾³£»áÎÊÎÒµÄÎÊÌ⣬ÏÖÔÚÎÒ¼òµ¥ÃèÊöÏÂÒ»¸öJava³õѧÕßµ½¾ÍҵҪѧµ½µÄһЩ¶«Î÷£º
Ê×ÏÈÒªÃ÷°×JavaÌåϵÉè¼Æµ½µÃÈý¸ö·½Ã棺J2SE,J2EE,J2ME£¨KJAVA£©¡£J2SE£¬Java 2 Platform Standard
Edition£¬ÎÒÃǾ³£Ëµµ½µÄJDK£¬¾ÍÖ÷ÒªÖ¸µÄÕâ¸ö£¬ËüÊÇÈýÕߵĻù ......
ƽʱÔÚ¹¤×÷µÄʱºò£¬×ÜÊǾõµÃ¸Õ±ÏÒµµÄͬÊÂÃǶԼ¼ÊõµÄÀí½â²»µ½Î»£¬ÖªÆäÈ»¶ø²»ÖªÆäËùÒÔÈ»¡£¿ÉÊÇ£¬¾²ÏÂÐÄÀ´ÏëÒ»Ï룬ÕâÒ²²»ÄÜÈ«¹ÖËûÃÇ£¬²»ÊÇÐÂÈËÃDz»°®
ѧ£¬¶øÊÇÏÖÈç½ñJava Web¿ª·¢µÄÈ·ºÜ·±¸´¡£±íÃæÉÏ¿´£¬ÏÖÔÚ»áJavaµÄÈ˶àÈçţ룬SSH ºÞ²»µÃÊÇÿ¸ö java ¿ª·¢Åàѵ¿ÎµÄ±ØÑ¡ÏîÄ¿£¬µ«
WEB ¿ª·¢µÄÃż÷£¬ÕæµÄ²»µÍ¡£µ±È»£¬ÎÒ˵²»µÍ£ ......
package com.hefeng.test;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.uti ......
package com.hongsoft.test;
import java.io.*;
//¶¨ÖƵÄÀà×°ÈëÆ÷
public class TestCompile extends ClassLoader
{
String _compiler;
String _classpath;
public static void main(String[] args)
{
new TestCompile();
}
public TestCompile()
{
super(ClassLoader.getSystemClassLoader());
//ĬÈϱàÒëÆ ......