ã¯ããã« æ¬ç¨¿ã§ã¯Struts 2ã«ã¦JSONã¬ã¹ãã³ã¹ãç°¡åã«æ±ããããã«ãªãStruts 2 JSONãã©ã°ã¤ã³ãç´¹ä»ãã¾ãã JSONã«ã¤ã㦠JSONã¯JavaScript Object Notationã®ç¥ç§°ã§ããJavaScriptã«ã¦ãªãã¸ã§ã¯ããè¨è¿°ããéã«ã使ããã表è¨æ³ã§ãAJAXãå©ç¨ããWEBã¢ããªã±ã¼ã·ã§ã³ã§ã¯é åã®ãã¼ã¿ãæ軽ã«æ±ãããã¨ããããç¾å¨ãã£ã¨ãå©ç¨ããã¦ããæ¹å¼ã§ãã詳細ãªä»æ§ã«ã¤ãã¦ã¯JSONã®ç´¹ä»ãåç §ãã ããã 対象èªè Struts 2ã®Webã¢ããªã±ã¼ã·ã§ã³éçºã«èå³ããæ¹ å¿ è¦ãªç°å¢ æä½åä½ç°å¢ã¯æ¬¡ã®ã¨ããã§ãã Java SE 5 Struts 2.2.1ãåä½ããç°å¢ Tomcat 5.5.x / 6.0.x Struts 2 JSONãã©ã°ã¤ã³ã¨ã¯ Struts 2 JSONãã©ã°ã¤ã³ã¯ãStruts 2ã®ã¢ããªã±ã¼ã·ã§ã³ã§ç°¡å
å¶æ¥æ¯æ´ã§ææ¡ä¸ã®æ¡ä»¶ãããã®ã§ãããç¾ç¶CGIï¼Perlã§ä½ããã¦ããã³ã³ã·ã¥ã¼ãã¼åããµã¤ãããããã CGIãªã®ã§æ§è½ãæªã ã³ã³ãã³ãã®ä¿®æ£ã大å¤ãªã®ã§MVCã§ãã¡ãã¨ä½ããã å®ç¸¾ã®ããJavaã¨Strutsãã¡ã¤ã³ã«æ¤è¨ãã¦ãã ã¨ã®ãã¨ã§ããä»æå¤ãã®ã³ã³ã·ã¥ã¼ãã¼ç³»ã®ãµã¤ãã§ãã³ã³ãã³ãã®ç®¡çã容æã«ããããªããªã¼ãã³ã½ã¼ã¹ãå«ãã¦PHPãã¼ã¹ã®CMSãæã®æ°ã»ã©ããã¨ããäºå®ã¯ããã¦ããã¨ãã¦ããã¨ã«ãããå®ç¸¾éè¦ã¨ãããã¨ã§Strutsã¨ãããã¨ã«ãªã£ã¦ãã¾ãã®ã§ããããï¼ã客æ§ãMVCãªã©ç¸å½æè¡ãåå¼·ããã¦ãããã¨ã¯æå¿ãªã®ã§ãããJavaã®MVCãã¬ã¼ã ã¯ã¼ã¯ã¨ããã¨Strutsããèããªãã¨ããã®ã¯åé¡ã§ã¯ãªãã®ã§ããããããå¤ãã®Strutsãã¼ã¹ã®æ¢åã·ã¹ãã ãèªç¤¾ã§æ±ãã¦ãããªã©ã®çç±ãããã®ã§ããã°ããããä¸ã¤ã®é¸æãªã®ããããã¾ããããå®ç¸¾éè¦ã¨ã社å
ã¯ããã« æ¬ç¨¿ã§ã¯Struts 2ã«æ°ããå°å ¥ãããå ¥åãã§ãã¯æ©æ§ã§ããOVal Frameworkã®ãã©ã°ã¤ã³ãç´¹ä»ãã¾ãã 対象èªè Struts 2ã®Webã¢ããªã±ã¼ã·ã§ã³éçºã«èå³ããæ¹ã å¿ è¦ãªç°å¢ æä½åä½ç°å¢ã¯æ¬¡ã®ã¨ããã§ãã Java SE 5 Struts 2.1.8.1ãåä½ããç°å¢ Tomcat 5.5.x / 6.0.x OVal Frameworkã¨ã¯ å ¥åãã§ãã¯ãæ ãä»çµã¿ã¨ãã¦Validationï¼åèè¨äºï¼Struts 2å ¥éï¼3ï¼ï½ããªãã¼ã·ã§ã³ã®ä»çµã¿ãç解ããï¼å¾ç·¨ï¼ï½ï¼ãããã¾ãããStruts 2.1.8.1ããæ°æ©è½ã¨ãã¦OVal Frameworkã®æ©è½ãå©ç¨ã§ããããã«ãªãã¾ãããOVal Frameworkï¼ä»¥éãOValã¨ç¥ãã¾ãï¼ã¨ã¯Javaãªãã¸ã§ã¯ãã«å¯¾ããå ¥åãã§ãã¯æ©è½ãæä¾ãããã¬ã¼ã ã¯ã¼ã¯ã§ãæ¢åã®Validationã§
ï¼¼ééäºå®ã®ãµã¤ãã売ããããï¼ï¼ ã¢ã¯ã»ã¹ããªããµã¤ããã³ã³ãã³ã価å¤ã§å£²ããå ´åã⦠ãã¡ã¤ã³ã®æå¹æéãæ´æ°ãã¦ãµã¤ã売å´ã«ãã©ã¤ãã¦ã¿ã¾ããã
SAStrutsã§ç°¡åã«Ajaxãæ±ããããã«ãã¾ããããµã³ãã«ã¯ãããªæãã package tutorial.action; import org.seasar.struts.annotation.Execute; import org.seasar.struts.util.ResponseUtil; public class AjaxAction { @Execute(validator = false) public String index() { return "index.jsp"; } @Execute(validator = false) public String hello() { ResponseUtil.write("ããã«ã¡ã"); return null; } } ã¢ã¯ã·ã§ã³ã§ãResponseUtil#write()ã使ã£ã¦ã¬ã¹ãã³ã¹ã«æååãæ¸ãåºãã ãã
GAE for Java with Strutsã§ã¯ãã¨ãããããµã³ãã«ã¢ããªãåããã¨ããã¾ã§ã§ãã¾ããã 次ã«ãStruts ã使ã£ãã¢ããªã±ã¼ã·ã§ã³ã®éçºããã¾ãããã (1) Java Build Path ãè¨å® ã¢ããªã±ã¼ã·ã§ã³ãå³ã¯ãªã㯠> Properties ãã [Java Buiild Path]ãé¸æãã[Libraries] ã¿ããé¸æãã¾ãã 次ã«ãGAE for Java with Strutsã®(4)ã§è¿½å ãã jar ãã¡ã¤ã«ãå ¨ã¦è¿½å ãã¾ãã (2) HelloStrutsActionã¯ã©ã¹ã®ä½æ net.seesaa.googleappengine ããã±ã¼ã¸ã« HelloStrutsAction ã¯ã©ã¹ãä½æãã¾ãããã®éãorg.apache.struts.action.Action ã¯ã©ã¹ãç¶æ¿ããã¾ãããã HelloStrutsAction
å ã®ãã°ã§ã¯ãGoogle App Engine/Javaï¼GAE/J)ã¸ãã¡ã¤ã«ãã¢ãããã¼ããããã¼ã¿ã¹ãã¢ã«Blobå½¢å¼ã§ä¿åããããä»åã¯ãããã§ä¿åãããã¼ã¿ãåãåºãã¦ããã¦ã³ãã¼ãï¼å¾©å ãã¦ã¿ãã 以ä¸ã®ãããªç»é¢ãç¨æããããã¦ã³ãã¼ãããã¿ã³ã§ãã¡ã¤ã«ããã¦ã³ãã¼ãããããã¦ã³ãã¼ããããã¡ã¤ã«ã¯ãååã®ãµã³ãã«ã§ã¢ãããã¼ããã¦ããã Strutsã«ã¯ãv1.2ããããã¡ã¤ã«ã®ãã¦ã³ãã¼ãã®ããã®DownloadActionã¨ããActionã¯ã©ã¹ãç¨æããã¦ãããã ãããã¡ã¤ã«ã·ã¹ãã ããã®ãã¦ã³ãã¼ããåæã«ãã¦ããã®ã§ãGAE/Jã§ã¯ä½¿ç¨ãããã¨ãã§ããªãããããã£ã¦ãï¼åååæ§ï¼ãããæãªããã®æ¹æ³ã§ãã¦ã³ãã¼ãå¦çãå®è£ ããã 以ä¸ã®ä½æ¥ã¯ãGAE/Jã®ãã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ãããEclipse3.4ï¼Ganymedeï¼ã§è¡ã£ãã ããã¸ã§ã¯ãã®ä½æ å¿ è¦ãª
Google App Engine SDK for Java ã« Struts1.3 ãçµè¾¼ã¿ã¾ããã ä½ãåé¡ãªãæ®éã«åãã¦ãã¾ããStruts ã触ããªããªã£ã¦ããéåçµã¡ã¾ããããã¯ãã¾ã 主æµã ããã¨ãããã¨ã§ãã¡ããã¨ç´¹ä»ãã¦ããã¾ãã æ¬å½ã¯ãmaven ã® archetype ã¨ãä½ããããã©ãGoogle æ§ãç¨æãã¦ããããã®ã¨ã®èª¿æ´ãªã©ãé£ããããªã®ã§ãä»åã¯ãwar/WEB-INF/lib 以ä¸ã«é¢é£ãã¡ã¤ã«ãããããã³ãã¼ãã¦ç°å¢æ§ç¯ãã¾ããã ç®çå°ã¯ãStruts ã§ç¨æããã¦ãããµã³ãã«ã¢ããªã GAE/J ã§åãããã¨ã§ãã (1) Struts ã®ã©ã¤ãã©ãªããã¦ã³ãã¼ã http://struts.apache.org/download.cgi#struts1310 ãããstruts-1.3.10-apps.zip ããã¦ã³ãã¼ããã¾ãããã (2)
Slim3ãGAE/Jã«å¯¾å¿ããã¾ããã ãã¢ãµã¤ãã¯ãã¡ãã http://higayasuo.appspot.com/ ã½ã¼ã¹ã³ã¼ãããã§ãã¯ã¢ã¦ããããå ´åã¯ãã¡ãã http://code.google.com/p/slim3/source/checkout https://slim3.googlecode.com/svn/ãæå®ãã¦ãã§ãã¯ã¢ã¦ãã§ãã¾ãããã¢ç¨ã®ããã¸ã§ã¯ãã¯ãslim3-demoã§ãã SAStrutsã®ãã¥ã¼ããªã¢ã«ããã£ããã¨ã®ãã人ãªãããã¢ãµã¤ããããã£ããã ã¨ãããã¨ããããã§ããããSlim3 Struts(SAStrutsç¸å½)ãGAE/Jã§åãããã§ãã ç´ ã®Strutsã ã¨GAEã§ã¯ãã¡ã¤ã«ã¢ãããã¼ãã«å¤±æãã¾ãããSlim3 Strutsã¯ãã®è¾ºã対å¿ãã¦ã¾ãã ãã£ã¦ã¿ã¦æããã®ã¯ãGAE/Jã¯ãå¶éãçµæ§å³ããã®ã§ãé«åº¦ãªãã¬ã¼ã ã¯ã¼
Strutsã®XMLå°çããéçºè ã解æ¾ããSAStrutsï¼Javaåå¿è ãè¶ ä¿æã«Webã¢ããªãä½ãæ¹æ³ï¼2ï¼ï¼1/3 ãã¼ã¸ï¼ Eclipseãã©ã°ã¤ã³ãDoltengãã®Scaffoldã¨ããèªåçææ©è½ãSeasar 2.4ã®HOT deployæ©è½ãå©ç¨ãã¦ãDBã®åç §ã»æ´æ°ã»åé¤ãã§ããSAStrutsã®Webã¢ããªãä½ãã¾ããJavaåå¿è ã ãã§ãªãStrutsã«æ £ããéçºè ãå¿ è¦ã§ã é£è¼ç¬¬1åã®ã1åã§Webã¢ããªãä½ããEclipseãã©ã°ã¤ã³ãDoltengããã§ã¯ãWebã¢ããªã±ã¼ã·ã§ã³éçºã«é常ã«ä¾¿å©ãªEclipseãã©ã°ã¤ã³ã§ãããDoltengãã®æ©è½ã使ç¨ãã¦ããSAStrutsãï¼å¾è¿°ï¼ã®ããã¸ã§ã¯ããèªåçæãã¾ããã ãã®Doltengã§èªåçæãããããã¸ã§ã¯ãã¨ã½ã¼ã¹ã¯ãã³ãã¬ã¼ãã¨ãã¦ã®åºæ¬çæ©è½ããä½æããã¦ãã¾ããï¼Doltengãé²åä¸ã§
æ å ±ãå°ãªãStruts2.1 ç¾å¨ãå½ããåã®ããã«ã·ã¹ãã éçºã§å©ç¨ããã¦ããSpringFrameworkãHibernateãªã©ã®ãªã¼ãã³ã½ã¼ã¹ã»ãã¬ã¼ã ã¯ã¼ã¯ãããããªã¼ãã³ã½ã¼ã¹ã»ãã¬ã¼ã ã¯ã¼ã¯ã®å é§ãã¨ãªã£ãStrutsã¯ãã¯ã¬ã¤ã°ã»ãã¯ãã©ãã³ããã¼ããµã¤ãã§åæ¡ãæ¸ãä¸ãããã¼ã¸ã§ã³1.0ã¨ãã¦å ¬éããã¦ãããä»å¹´ã§æ©ãã10å¹´ãçµã¨ãã¨ãã¦ãã¾ããããã¦ç´10å¹´ãçµã¦ããªããStrutsã¯éçºè ããã®è¡°ããªã人æ°ãä¿ã£ã¦ãã¾ãã ããããå½å ã§ã®Struts人æ°ã¯ãæåã«çºè¡¨ãããStrutsã®ç³»èãå¼ãç¶ããã¼ã¸ã§ã³çªå·ã«1ãå ããStruts1ç³»ã«å¯¾ãããã®ã§ãããWebWork2ã¨åä½ãããã¼ã¸ã§ã³çªå·ã«2ãå ããStruts2ç³»ã®äººæ°ã¯ä»ã²ã¨ã¤ãªãããã«æãã¾ããæè¿ã§ã¯ãStruts2ç³»ã®ææ°ãã¼ã¸ã§ã³2.1.6ãçºè¡¨ãããStruts1ç³»ãããéåã¨ç°¡åã«ä¾¿
ï¼¼ééäºå®ã®ãµã¤ãã売ããããï¼ï¼ ã¢ã¯ã»ã¹ããªããµã¤ããã³ã³ãã³ã価å¤ã§å£²ããå ´åã⦠ãã¡ã¤ã³ã®æå¹æéãæ´æ°ãã¦ãµã¤ã売å´ã«ãã©ã¤ãã¦ã¿ã¾ããã
ç¹éï¼ç¬¬1åããã¬ã¼ã ã¯ã¼ã¯ãStrutsãã®åºç¤ãç¥ã (1/8) Javaããã°ã©ãã³ã°ã§ã¯å®åã©ã¤ãã©ãªãå ±æããããã¬ã¼ã ã¯ã¼ã¯ã¨å¼ã¶ä»çµã¿ãããããStrutsãã¯ãã¾ãã¡ã°ãããããªã½ããã¨ãã¦æ³¨ç®ããã¦ããã Javaç¹éããªã¼ãã³ã½ã¼ã¹ã§ä½ãJavaï¼DBãã§ã¯ãJSPãç¨ãã¦ãã¼ã¿ãã¼ã¹ã«ã¢ã¯ã»ã¹ããææ³ã解説ããããã®ç¹éãStrutsã«ããWebã¢ããªã±ã¼ã·ã§ã³å ¥éãã§ã¯ãJavaã§Webã¢ããªã±ã¼ã·ã§ã³ãä½ãéã«ä½¿ãããã¬ã¼ã ã¯ã¼ã¯ãã½ããã®ã²ã¨ã¤ã§ãããStrutsãã使ããWebã¢ããªã±ã¼ã·ã§ã³ãæ§ç¯ããæ¹æ³ãç´¹ä»ãããã ãã¬ã¼ã ã¯ã¼ã¯ã¯å ±éå©ç¨ã®å®åã©ã¤ãã©ãª JSPã使ã£ã¦Webã¢ããªã±ã¼ã·ã§ã³ãæ§ç¯ããæ¹æ³ã«ã¤ãã¦ã¯ããã§ã«ãJSPããã°ã©ãã³ã°å ¥éããããªã¼ãã³ã½ã¼ã¹ã§ä½ãJavaï¼DBãã«ã¦è§£èª¬ãããå°è¦æ¨¡ãªWebã¢ããªã±ã¼ã·ã§ã³ã§ããã°ãJSPã ã
Struts2ã®prepareã¤ã³ã¿ã¼ã»ãã¿ã¼ãå©ç¨ããã¨ã¡ã½ããå®è¡åã«å¦çãè¡ããããã¨ãã§ããããã«ãªãã å®è¡ããã¡ã½ããã«ãã£ã¦åå¦çã§è¡ãå 容ãå¤æ´ãããå ´åã¯ãstaticParamsã§ãã©ã¡ã¼ã¿ãæ³¨å ¥ãã¦ãããããã®å¤ã§æ¯ãåãããããªãã¨ãèãã¦ããã Struts2ã®è¨å®çã«ã¯ããªãæãã®ã¤ã¡ã¼ã¸ <action name="sample" class="SampleAction" method="doFoo"> <param name="mode" value="foo"> </action> <action name="sample" class="SampleAction" method="doBar"> <param name="mode" value="bar"> </action> ããã¦Action㯠String mode; public void se
ãµã¼ãã¹çµäºã®ãç¥ãã ãã¤ãYahoo! JAPANã®ãµã¼ãã¹ããå©ç¨ããã ãèª ã«ãããã¨ããããã¾ãã ã客æ§ãã¢ã¯ã»ã¹ããããµã¼ãã¹ã¯æ¬æ¥ã¾ã§ã«ãµã¼ãã¹ãçµäºãããã¾ããã ä»å¾ã¨ãYahoo! JAPANã®ãµã¼ãã¹ããæ顧ãã ããã¾ãããããããããé¡ããããã¾ãã
ãã°ã¤ã³ç·¨ WEBç»é¢ã§ããå¿ è¦ã¨ãªãã®ã¯ãã°ã¤ã³æ©è½ã§ããæ¬ç« ã§ã¯ããã°ã¤ã³ç»é¢ã¨ãã°ã¤ã³å¾ã®ã»ãã·ã§ã³ç®¡çãå®ç¾ããæ¹æ³ã«ã¤ãã¦èª¬æãã¾ãã LoginInterceptor.javaã®ä½æ ãããããæ¬ç« ã®ã¡ã¤ã³é¨åã§ããLoginInterceptorã¯ã©ã¹ã§ãã LoginInterceptor.javaã«ä»¥ä¸ã®è¨è¿°ããã¾ãã /* * ãã°ã¤ã³ã¤ã³ã¿ã¼ã»ãã¿ã¼ */ package pkg.sample; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionInvocation; import
Java | Struts2 å ¥åãã©ã¼ã ã®ç¢ºèªç»é¢ å人äºæ¥ä¸»ã®ã¤ã¶ãã | Struts2 Sample 㨠Spring ç¶å ± ãã¦ãStruts1ã§ã¯ãstruts-configã§actionã®scopeã決ãããã¨ãåºæ¥ãã ç§ã¯(è¯ãããæ¹ãåãããªãã)ãããã確èªç»é¢ãæããããªç»é¢ã¯session="scope"ã«ãã¦ãä½ããã¨ãå¤ãã ããããã¨ã確èªç»é¢ã«hiddenãæ¸ããã¨ãç¡ããªãããã ããªãã®å´å軽æ¸ã«ãªãã ãããStruts2ã§å®ç¾ããæ¹æ³ãè¦ä»ãããªãã£ãã ãã®ãããä¸æçã«formãsessionã«è©°ããã¨ãããã¨ããã¦ããã (confirm,submitã®1è¡ç®ãããã«ãããã) ãããããããªãã®ãï¼ã¡ãã£ã¨åãããªããStruts2ã§ãå ¥åãã©ã¼ã â確èªç»é¢âå®äºç»é¢ã®ããã¼ãå®è£ ããå ´åã®ãã¹ããã©ã¯ãã£ã¹ãæ¢ãã¦ãããã ãã©
Comment: Removed link to tag reference - this is the tag reference page, right ? View page history
ã¢ãã« - Component åºæ¬ã¯ã©ã¹ããæ¡å¼µãããã¢ãã«ãUI ã¢ã¼ããã¯ãã£ã®ã¢ãã«ã«ã¯ã追å ã®å½¹å²ãããã¾ããã¢ãã«ã¯ãå®è£ ã«ä¾åããªããã¼ã¿ã³ã³ããã§ãããªããã使ç¨ããããã³ãã¬ã¼ããæå®ãããã¨ã«ãããããèªä½ãã©ã®ããã«ã¬ã³ããªã³ã° (ã¤ã¾ã表示) ãããã¨ããæ å ±ãæä¾ãã¾ãã ãã¥ã¼ - ãã³ãã¬ã¼ãã«ãã£ã¦çæãããæçµç㪠HTMLãé常ã¯ãã¿ã°ã©ã¤ãã©ãªã®Java ã³ã¼ãããå¿ è¦ãªãã¸ãã¯ãæä¾ããHTML ã³ã¼ããåºåã¹ããªã¼ã ã«æ¸ãè¾¼ãã§ãã¾ããããã®æ©è½ããã³ãã¬ã¼ãè¨èªã«ä»»ããããããã«ãããã¨ã¯ãæè»æ§ã®åä¸ã«ã¤ãªããã¾ãã ãã³ã: Struts2 ã§ã¯ããããã¤ã¡ã³ã使ç¨ã§ãããã¼ããè¤æ°ç¨æããã¦ãããã¿ã°ã®è¡¨ç¤ºãã¬ã³ããªã³ã°ããå ´åãããã©ã«ãã§ã¯ãxhtml ãã¼ãã使ç¨ããã¾ããxhtml ãã¼ãã¯ããã¼ãã«ã使ç¨ããã¬ã¤ã¢ã¦ããæ¤è¨¼ã¡ãã»
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}