¥Ñ¥ï¡¼¥Ó¡¼¥ó¥º¡¦¥³¡¼¥Ç¥£¥ó¥°µ¬Ìó
Contents
- ̿̾µ¬Ìó
- import¤ÎÀë¸À
- if¡¢while¡¢for¤Îµ¬Â§
- JDBC»ÈÍÑ»þ¤Îµ¬Â§
- JavaDoc¤Îµ¬Â§
- EJB¥¯¥é¥¹Ì¾¤Î̿̾µ¬Â§
¥Ñ¥ï¡¼¥Ó¡¼¥ó¥º¡¦¥³¡¼¥Ç¥£¥ó¥°µ¬Ìó
¥×¥í¥°¥é¥à³«È¯¤Ë¤ª¤±¤ë¥³¡¼¥Ç¥£¥ó¥°µ¬Ìó¤Ë¤Ä¤¤¤Æ½Ò¤Ù¤Þ¤¹¡£
̿̾µ¬Ìó
¥í¡¼¥«¥ëÊÑ¿ô̾¡¢°ú¿ô̾¡¢¥¯¥é¥¹Ì¾¡¢¥á¥½¥Ã¥É̾¡¢¥¯¥é¥¹ÊÑ¿ô̾¤Î̿̾¤Ë¤Ä¤¤¤Æ¤Îµ¬Ìó¡£
(1) ¶¦ÄÌ»ö¹à
»ÈÍѲÄǽʸ»ú¤ÏȾ³Ñ±Ñ¿ôʸ»ú¤È¥¢¥ó¥À¡¼¥¹¥³¥¢¡¼¤À¤±¤Ç¤¹¡£
»ÈÍѲÄǽʸ»ú¡§
(2) ¥í¡¼¥«¥ëÊÑ¿ô̾
Ⱦ³Ñ±Ñ»ú¤Î¾®Ê¸»ú¤ÈȾ³Ñ¿ô»ú¤Î¤ß¤Ç¥¢¥ó¥À¡¼¥¹¥³¥¢¡¼¶èÀÚ¤ê¤È¤·¤Þ¤¹¡£
Note
¤³¤ì¤Ï¥×¥í¥°¥é¥à¤òÂè»°¼Ô¤¬¸«¤¿¤È¤¤Ë¥í¡¼¥«¥ëÊÑ¿ô¤«¥¯¥é¥¹ÊÑ¿ô¤«¤ò
°ìÌܤÇȽÃǤǤ¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¹¡£
Îã
NG¡§
OK¡§
(3) °ú¿ô̾
Ⱦ³Ñ±Ñ»ú¤Î¾®Ê¸»ú¤ÈȾ³Ñ¿ô»ú¤Î¤ß¤Ç¥¢¥ó¥À¡¼¥¹¥³¥¢¡¼¶èÀÚ¤ê¤È¤·¤Þ¤¹¡£
Note
¤³¤ì¤Ï¥×¥í¥°¥é¥à¤òÂè»°¼Ô¤¬¸«¤¿¤È¤¤Ë¥í¡¼¥«¥ëÊÑ¿ô¤«¥¯¥é¥¹ÊÑ¿ô¤«¤ò
°ìÌܤÇȽÃǤǤ¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¹¡£
Îã
NG¡§public ActionForward execute( ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest req, HttpServletResponse res ) throws IOException, ServletException {
OK¡§public ActionForward execute( ActionMapping action_mapping, ActionForm action_form, HttpServletRequest req, HttpServletResponse res ) throws IOException, ServletException {
(4) ¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¤Þ¤¹¡£
Îã
NG¡§public class admMstAccountAction extends WafActionSupport { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res ) throws IOException, ServletException {
OK¡§public class AdmMstAccountAction extends WafActionSupport { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res ) throws IOException, ServletException {
(5) ¥á¥½¥Ã¥É̾
Ⱦ³Ñ±Ñ»ú¤Î¾®Ê¸»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¤Þ¤¹¡£
Îã
NG¡§public void DoStoreAction( HttpServletRequest req, HttpServletResponse res, AdmMstAccountForm form ) {
OK¡§public void doStoreAction( HttpServletRequest req, HttpServletResponse res, AdmMstAccountForm form ) {
(6) ¥¯¥é¥¹ÊÑ¿ô̾
Ⱦ³Ñ±Ñ»ú¤Î¾®Ê¸»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¤Þ¤¹¡£
Warning
Æüì¤Ê¾ì¹ç¤Ï¡¢¤³¤ÎÈϰϤǤϤʤ¤¡£
Îã
NG¡§
OK¡§
import¤ÎÀë¸À
import¤ÎÀ©¸Â¤Ï"*"¤Ç½¸Ì󤻤º¤Ë¸Ä¡¹¤ËÀë¸À¤¹¤ë¤³¤È¡£
Îã
NG¡§import javax.ejb.EJBLocalHome; import javax.naming.*; import javax.servlet.*;
OK¡§import javax.ejb.EJBLocalHome; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
if¡¢while¡¢for¤Îµ¬Â§
¼Â¹Ô¤¹¤ë¥¹¥Æ¡¼¥È¥á¥ó¥È¤¬1¹Ô¤Ç¤¢¤Ã¤Æ¤âɬ¤º{}¤òµ½Ò¤¹¤ë¤³¤È¡£
Îã
NG¡§if ( !result.next() ) return false;
OK¡§if ( !result.next() ) { return false; }
JDBC»ÈÍÑ»þ¤Îµ¬Â§
¥¯¥é¥¹Ì¾¡¢¥á¥½¥Ã¥É̾¡¢¥¯¥é¥¹ÊÑ¿ô¡¢¥í¡¼¥«¥ëÊÑ¿ô¡¢°ú¿ô¤Î̿̾¤Ë¤Ä¤¤¤Æ¤Îµ¬Ìó¡£
(1) ResultSet¤Ë¤Æ·ë²Ì¤ò¼èÆÀ¤¹¤ëºÝ¤Ë¥«¥é¥à¡¦¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ç¼èÆÀ¤»¤º¤Ë¡¢¥«¥é¥à̾¤Ç¼èÆÀ¤¹¤ë¡£
Îã
NG¡§result.getTimestamp(i++), result.getTimestamp(i++), result.getTimestamp(i++), result.getInt(i++), result.getString(i++),
OK¡§result.getTimestamp("appendDate"), result.getTimestamp("modifyDate"), result.getTimestamp("deleteDate"), result.getInt("deleteKubun"), result.getString("account"),
(2) ResultSet¡¢PreparedStatement¡¢Connection¤Î¥¯¥í¡¼¥º¤Î½èÍý
ɬ¤º finally ¤Ç¹Ô¤¦¤³¤È¡£
Note
¤³¤ì¤ÏException¤¬È¯À¸¤·¤¿¤È¤Åù¡¢É¬¤º¥¯¥í¡¼¥º½èÍý¤¬¼Â¹Ô¤¹¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¹¡£
Îã
NG¡§
OK¡§
JavaDoc¤Îµ¬Â§
ɬ¤º¥¯¥é¥¹¡¢¥á¥½¥Ã¥É¡¢¥¯¥é¥¹ÊÑ¿ô¤Ë¤ÏJavaDoc¤òµ½Ò¤·¤Æ¤¯¤À¤µ¤¤¡£
(1) ¥¯¥é¥¹
JavaDoc¤ÎÀâÌÀʸ¤Ï¡Ö<p>¥¿¥¤¥È¥ë¡§¡Á</p>¡×¡¢¡Ö<p>ÀâÌÀ¡§¡Á</p>¡×¤È¸À¤¦¹½À®¤Çµ½Ò¤·¤Æ¤¯¤À¤µ¤¤¡£
(2) ¥á¥½¥Ã¥É
JavaDoc¤ÎÀâÌÀʸ¤Ï¡Ö<p>¥¿¥¤¥È¥ë¡§¡Á</p>¡×¡¢¡Ö<p>ÀâÌÀ¡§¡Á</p>¡×¤È¸À¤¦¹½À®¤Çµ½Ò¤·¤Æ¤¯¤À¤µ¤¤¡£
¤½¤ì¤È¡¢¤³¤³¤Ç¤âɬ¤º¡Ö@author¡×¤òÆþ¤ì¤Æ¤¯¤À¤µ¤¤¡£
(3) ¥¯¥é¥¹ÊÑ¿ô
¡Ö/**¡×¤È¡Ö*/¡×¤Ç°Ï¤ó¤Çµ½Ò¤·¤Þ¤¹¡£
EJB¥¯¥é¥¹Ì¾¤Î̿̾µ¬Â§
EJB¥¯¥é¥¹Ì¾¤Î̿̾¤Ë¤Ä¤¤¤Æ¤Îµ¬Ìó¡£
(1) ¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë̾¡£
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËJAR¤òÉÕ¤±¤ë¡£
ÎãAdministratorJAR
(2) ¥¨¥ó¥Æ¥£¥Æ¥£¡¦¥Ó¡¼¥ó¤Ç¤Î display-name¤Î»ØÄê
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËEB¤òÉÕ¤±¤ë¡£
ÎãAdmMstQuestionEB
(3) ¥¨¥ó¥Æ¥£¥Æ¥£¡¦¥Ó¡¼¥ó¤Ç¤Î ejb-name¤Î»ØÄê
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËEJB¤òÉÕ¤±¤ë¡£
ÎãAdmMstQuestionEJB
(4) ¥¨¥ó¥Æ¥£¥Æ¥£¡¦¥Ó¡¼¥ó¤Ç¤Î local-home¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËLocalHome¤òÉÕ¤±¤ë¡£
ÎãAdmMstQuestionLocalHome
(5) ¥¨¥ó¥Æ¥£¥Æ¥£¡¦¥Ó¡¼¥ó¤Ç¤Î local¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËLocal¤òÉÕ¤±¤ë¡£
ÎãAdmMstQuestionLocal
(6) ¥¨¥ó¥Æ¥£¥Æ¥£¡¦¥Ó¡¼¥ó¤Ç¤Î ejb-class¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËBean¤òÉÕ¤±¤ë¡£
ÎãAdmMstQuestionBean
(7) ¥»¥Ã¥·¥ç¥ó¡¦¥Ó¡¼¥ó¤Ç¤Î display-name¤Î»ØÄê
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËSB¤òÉÕ¤±¤ë¡£
ÎãShoppingControllerSB
(8) ¥»¥Ã¥·¥ç¥ó¡¦¥Ó¡¼¥ó¤Ç¤Î ejb-name¤Î»ØÄê
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËEJB¤òÉÕ¤±¤ë¡£
ÎãShoppingControllerEJB
(9) ¥»¥Ã¥·¥ç¥ó¡¦¥Ó¡¼¥ó¤Ç¤Î local-home¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËLocalHome¤òÉÕ¤±¤ë¡£
ÎãShoppingControllerLocalHome
(10) ¥»¥Ã¥·¥ç¥ó¡¦¥Ó¡¼¥ó¤Ç¤Î local¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËLocal¤òÉÕ¤±¤ë¡£
ÎãShoppingControllerLocal
(11) ¥»¥Ã¥·¥ç¥ó¡¦¥Ó¡¼¥ó¤Ç¤Î ejb-class¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËBean¤òÉÕ¤±¤ë¡£
ÎãShoppingControllerBean
(12) WEB¥µ¡¼¥Ó¥¹¤Ç¤Î ejb-name¤Î»ØÄê
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËEndpointBean¤òÉÕ¤±¤ë¡£
ÎãAirlinePOEndpointBean
(13) WEB¥µ¡¼¥Ó¥¹¤Ç¤Î service-endpoint¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËIntf¤òÉÕ¤±¤ë¡£
ÎãAirlinePOIntf
(14) WEB¥µ¡¼¥Ó¥¹¤Ç¤Î ejb-class¤Î¥¯¥é¥¹Ì¾
Ⱦ³Ñ±Ñ»ú¤ÎÂçʸ»ú»Ï¤Þ¤ê¤È¤·¡¢È¾³Ñ±Ñ¿ôʸ»ú¤Î¤ß¤ÇȾ³Ñ±Ñ»ú¤ÎÂçʸ»ú¶èÀÚ¤ê¤È¤·¡¢ºÇ¸å¤ËEndpointBean¤òÉÕ¤±¤ë¡£
ÎãAirlinePOEndpointBean
Åê¹Æ¤µ¤ì¤¿ÆâÍƤÎÃøºî¸¢¤Ï¥³¥á¥ó¥È¤ÎÅê¹Æ¼Ô¤Ëµ¢Â°¤·¤Þ¤¹¡£