Arch4ϵͳ¿ª·¢Ö¸ÄÏ-¿ª·¢¹æ·¶Æª ÖпÆÈí¿Æ¼¼¹É·ÝÓÐÏÞ¹«Ë¾
2. ins.subsystems.module.web°üϵÄÀàÈ«²¿¶¼ÒªÒÔ¡°Action¡±½áβ¡£ 3. ActionÀà±ØÐë¼Ì³Ðins.components.web.Struts2ActionnÀà¡£ 4. ÀàÃûΪ£ºÄ£¿éÃû+ºó׺£¬È籨°¸Ä£¿éµÄWeb²ãJavaÀàÃûΪ RegistAction
6.2.2 Àà±à³Ì¹æ·¶
1. ÔÚWEB²ãÀ಻ÔÊÐíÓá°new¡±¹Ø¼ü×Ö´´½¨ÒµÎñ²ãºÍ³Ö¾Ã²ãÀà¶ÔÏó¡£
2. ÔÚWEB²ãÀ಻ÔÊÐí³öÏÖÓëSQLÓï¾äÏà¹ØµÄ´úÂ룬²»ÔÊÐíµ÷ÓÃÈκÎÀàƴдSQLÓï¾ä¡£
6.2.3 ·½·¨±à³Ì¹æ·¶
1. µ÷ÓÃÒµÎñ²ãµÄService±ØÐëͨ¹ý½Ó¿Ú×¢Èë¡£
2. ÔÚ²éѯºÍ·Ò³²éѯµÄ·½·¨ÖУ¬±ØÐë°Ñ´ÓÒµÎñ²ãService·µ»ØµÄ½á¹û¼¯´æ·Åµ½Page¶ÔÏóÖС£ 3. WEB²ãµÄÀàÖ®¼ä²»ÔÊÐí»¥Ïàµ÷Óá£
4. WEB²ã½ö¿ÉÒÔÅ׳öDataVerifyExceptionºÍPermissionException¡£
5. ·½·¨ÃûΪ£º¶¯´Ê£«Ãû´Ê£¬ÈçÐÂÔö±¨°¸·½·¨ÃûΪ addRegist£¬¸üб¨°¸ÎªupdateRegist¡£
6.3 ÒµÎñ²ã¹æ·¶
6.3.1 ÃüÃû¹æ·¶
1. ins.subsystems.module.service°üϲ»ÄÜÓÐÎļþ¡£
2. ins.subsystems.module.service.facade°üϵĽӿÚÃû±ØÐëÒÔService½áβ¡£ 3. ins.subsystems.module.service.spring°üϵÄÀàÃû±ØÐëÒÔServiceSpringImpl½áβ¡£
4. ÀàÃûΪ£ºÄ£¿éÃû+ºó׺£¬È籨°¸Ä£¿éµÄÒµÎñ²ãJavaÀàµÄfacadeÃûΪ RegistService£¬ÆäSpringµÄ
ʵÏÖÀàµÄÃû×ÖΪRegistSeviceSpringImpl
6.3.2 ·½·¨ÃüÃû¹æ·¶
Service·½·¨ÃüÃû¹æ·¶ÈçÏ£º ·½·¨Ç°×º add update find check delete ˵Ã÷ Ôö¼Ó ¸üР²éѯ¡¢»ñÈ¡µÈ(µ¥Ìõ»ò¶àÌõ¼Ç¼£© ¼ì²é ɾ³ý ʾÀý addUser¡¢addRole updateUser¡¢updateRole findUser¡¢findRole¡¢findUserById¡¢findUserByUserCode deleteUser¡¢deleteRole ×¢Ò⣺ÓÉÓÚºÍgetter·½·¨»ìÏý£¬ÕâÀï²»²ÉÓÃget×÷ΪҵÎñ·½·¨µÄǰ׺£¬¶ø¸ÄÓÃfind¡£
µÚ 13 Ò³ ¹² 20 Ò³
Arch4ϵͳ¿ª·¢Ö¸ÄÏ-¿ª·¢¹æ·¶Æª ÖпÆÈí¿Æ¼¼¹É·ÝÓÐÏÞ¹«Ë¾
6.3.3 Àà±à³Ì¹æ·¶
1. ËùÓеÄServiceSpringImplÀà±ØÐëʵÏÖ¶ÔÓ¦µÄService½Ó¿Ú£¬ÀàºÍ½Ó¿ÚµÄÃû³Æ½öÏà²î¡°SpringImpl¡±¡£ 2. ServiceSpringImplÀà±ØÐëÅäÖÃÔÚ/src/resources/spring/serviceContext.xmlÎļþÖУ¬
Öµ±ØÐëÊÇÊ××ÖĸСдµÄService½Ó¿ÚÃû¡£
3. ServiceSpringImplÀàµÄÀà±äÁ¿Ö»ÄÜÓÃÓÚ¶¨ÒåServiceÒýÓã¬ÇÒÖ»¿ÉÓÃprivateÐÞÊΣ¬¶ÔÓÚÕâЩService
ÒýÓã¬Ö»ÐèÒªÔÚServiceSpringImplÀàÖÐÉú³Éset·½·¨¡£
4. ServiceSpringImplÀàµÄServiceÒýÓõıäÁ¿Ãû±ØÐëÓëserviceContext.xmlÎļþÖж¨ÒåµÄ
µÄidÊôÐÔÖµÏàͬ¡£
6.3.4 ·½·¨±à³Ì¹æ·¶
1. ÔÚServiceSpringImplÀàÖв»ÔÊÐíʹÓá°new¡±¹Ø¼ü×Ö´´½¨³Ö¾Ã²ã¶ÔÏóºÍWEB²ã¶ÔÏó¡£ 2. ÔÚÒµÎñ²ã½ö¿ÉÒÔÅ׳öBusinessException¡£
6.4 ʵÌåÀà(PO)¹æ·¶
1. POÀàÓÉHibernateTools£¨Sinosoft°æ±¾£©Éú³É£¬²»ÔÊÐí×öÈκÎÐ޸ĵģ¬Ò²²»ÔÊÐíÔÚÕâ¸ö°üÏÂÐÂÔö
Àà¡£
2. POÀàÖеÄÊôÐÔÇø·Ö´óСд£¬ÔÚ±àдhibernate.reveng.xmlÎļþʱָ¶¨½«×Ô¶¯Éú³É¡£ 3. POÀàͳһÉú³Éµ½ins.subsystems.schema.model°üÏ£¨²»·ÖÄ£¿é£©¡£ 4. ÀàÃûΪ£º¶ÔÏóÃû¡£Í¨³£°´ÕÕ±íÃûÃüÃû£¬Çø·Ö´óСд¡£
È磺±íprplregist¶ÔÓ¦µÄPOÀàΪPrpLregist
µÚ 14 Ò³ ¹² 20 Ò³
Arch4ϵͳ¿ª·¢Ö¸ÄÏ-¿ª·¢¹æ·¶Æª ÖпÆÈí¿Æ¼¼¹É·ÝÓÐÏÞ¹«Ë¾
7 ʵÏÖ¸ßЧJava±à³ÌµÄ»ù´¡¹æÔò
7.1 ±ÜÃâʹÓÃnew¹Ø¼ü×ÖÀ´´´½¨String¶ÔÏó
°ÑÒ»¸öString³£Á¿copyµ½String ¶ÔÏóÖÐͨ³£ÊǶàÓà¡¢ÀË·Ñʱ¼äµÄ¡£
public class test{ public void method(){ System.out.print (str); } private String str = new String (\ÕâÀïн¨¶ÔÏóÊÇÍêȫûÓбØÒªµÄ private String str2=¡±2¡± //ÕýÈ·µÄÓ¦¸ÃÈç´Ë } 7.2 ±ÜÃâʹÓò»±ØÒªµÄǶÌ×
¹ý¶àµÄǶÌ×»áʹÄãµÄ´úÂ븴ÔÓ»¯£¬¼õÈõ¿É¶ÁÐÔ¡£
public class test { string add (){ int c=(a=a+b)+b; //¹ýÓÚ¸´ÔÓ return c } } 7.3 ±ÜÃâÔÚͬһÐÐÉùÃ÷¶à¸ö±äÁ¿
±ÜÃâÔÚͬһÐÐÉùÃ÷¶à¸ö±äÁ¿£¬ÕâÑù¿ÉÒÔʹ³ÌÐò¸ü¼ÓÇåÎú£¬Ìá¸ß¿É¶ÁÐÔ¡£ ´íÎóµÄ·½·¨£º
private int index, index1[]; ÕýÈ·µÄ·½·¨£º
private int index; private int index1[]; 7.4 ±ÜÃâʹÓò»ÍƼöµÄAPI
±ÜÃâʹÓò»ÍƼöµÄAPI¡£ÓÐһЩ·½·¨¼ÓÁË\±ê¼Ç£¬±íʾ²»ÍƼöʹÓã¨Í¨³£ÔÚJavaDocÖл¹ÌṩÁËÌæ´ú·½·¨£©¡£ÈçListÀàÖÐadd·½·¨¼ÓÁË\±ê¼Ç£¬²Î¿¼JavaDoc·¢ÏÖÆ佨ÒéÓÃadd()À´´úÌæaddItem()¡£
´íÎóµÄ·½·¨£º
µÚ 15 Ò³ ¹² 20 Ò³
Arch4ϵͳ¿ª·¢Ö¸ÄÏ-¿ª·¢¹æ·¶Æª ÖпÆÈí¿Æ¼¼¹É·ÝÓÐÏÞ¹«Ë¾
List dataList = new ArrayList (); dataList.addItem (str);
ÕýÈ·µÄ·½·¨£º
List dataList = new ArrayList (); dataList.add (str); 7.5 ±ÜÃâ°Ñ·½·¨±¾µØ±äÁ¿ºÍ²ÎÊý¶¨Òå³ÉºÍÀà±äÁ¿ÏàͬµÄÃû×Ö
°ÑÈκεıäÁ¿¶¼¶¨Òå³ÉΨһµÄ£¬±ÜÃâÒýÆð»ìÏý¡£ ´íÎóµÄ·½·¨£º
public void method (int j) { final int i = 5; // VIOLATION } private int j = 2; ÕýÈ·µÄ·½·¨£º
public void method (int j1) { final int i = 5; // VIOLATION } private int j = 2; 7.6 ΪËùÓÐÐòÁл¯µÄÀà´´½¨serialVersionUID
ΪËùÓÐÐòÁл¯µÄÀà´´½¨Ò»¸öserialVersionUID£¬¿ÉÒÔ±ÜÃâÆÆ»µÐòÁеļæÈÝÐÔ¡£Èç¹û²»ÌرðÖƶ©Ò»¸öUIDµÄ»°£¬ÏµÍ³»á×Ô¶¯¼ÆËãUID£¨¸ù¾ÝÀàµÄÄÚÈÝ£©¡£Èç¹ûÀà±»¸Ä±äÁË£¬¼´Ê±ËüÊǼæÈݵģ¬ÄãÒ²²»ÄÜ·´ÐòÁл¯Àϵİ汾ÁË¡£ÔÚÀàÖмÓÈçÒ»¸öUID£¬±àÂë¿ØÖÆÀàµÄ¼æÈÝÐÔ¡£ ´íÎóµÄ·½·¨£º
public class DUID implements java.io.Serializable { public void method () {} } ÕýÈ·µÄ·½·¨£º
public class DUIDFixed implements java.io.Serializable { private static final long serialVersionUID = 1L; public void method () {} } 7.7 ³£Á¿µÄ¶¨Òå¼ÓÉÏfinal¹Ø¼ü×Ö
³£Á¿µÄ¶¨ÒåÓ¦¸Ã¼ÓÉÏfinal±ê¼Ç£¬±£Ö¤³£Á¿Öµ´Ó×ÔʼÖÁÖÕ¶¼²»»á¸Ä±ä¡£ ´íÎóµÄ·½·¨£º
private int SIZE = 5; ÕýÈ·µÄ·½·¨£º
µÚ 16 Ò³ ¹² 20 Ò³