OGNLã®ãªãã§ãã§ãã便å©ãã¯å®è£ ã®çãã«ããè å¨ã«å¯¾ãã¦ç¡é²åã¨ãªãå¯è½æ§ãããã¾ããããhttps://www.sec-consult.com/files/20120104-0_Apache_Struts2_Multiple_Critical_Vulnerabilities.txt2.3.1 ãªã©ç¸å½æ¯ããã¨æããããã¼ã¸ã§ã³ã§ãå¤é¨ããâ¦
Struts2ã®è¨å®ã§ default-interceptor-ref ãæå®ããã¨ãã¡ãã¡åå¥ã® Action ã« interceptor-ref ãæ¸ããªãã§æ¸ãã®ã§ package 㧠default-interceptor-ref ãæå®ã㦠package å ã® Action ã§ã¯ãã¹ã¦å ±éã®interceptorã¹ã¿ãã¯ãé©ç¨ãããããªæå®æ¹æ³â¦
以åJSPã®é¨ååãæ¤è¨ããã¨ãã« s:includeã«ããé¨ååã¯ä»®å¼æ°ã使ããªããªã©ãã¾ãã¡ä½¿ãåæãè¯ããªãã¨çµè«ä»ãããæè¿ã¨ã¦ãè¯ãæ¹æ³ãæãã¤ãããããã¯
æ¯æ¥ã³ãã¥ãã±ã¼ã·ã§ã³ãºç¤¾ããæ¬ãµã¤ãé¢é£ã®Struts2ã¨åã³ã³ãã¼ãã³ãã®æ¥æ¬èªã®æ¬ãåºçããããã¨ã«ãªãã¾ãããStruts2 ãã«ã¹ã¿ãã¯å&Webã¢ããªã±ã¼ã·ã§ã³éçº ~Struts2+Spring 2+Tiles+iBATIS+GWTã§ä½ãã·ã§ããã³ã°ãµã¤ã~ä½è : ä¸å½é¸æåºç社/â¦
Struts2ã2.0.12ã«ãã¼ã¸ã§ã³ã¢ãããã¦ãããã¢ããã°ã¬ã¼ãã¯jarãå·®ãæ¿ããã ããªã®ã§åé¡ã¯ç¡ããã©ã¡ãã£ã¨ã¯ã¾ã£ãã®ã§ããã WTPç°å¢ã§ãWEB-INF/lib ä¸ã®å¤ããã¼ã¸ã§ã³ã®jarãåé¤ãã¦ãæ°ããjarã«å ¥ãæ¿ããµã¼ãã¼ãèµ·åãããã¨ããã¨ãã Unabâ¦
Struts2ã§Interceptorã®ãã©ã¡ã¼ã¿ãè¨å®ããå ´åã <interceptor-ref name="hoge"> <param name="fileUpload.maxallowsize">10000</param> </intrerceptor-ref> ãªã©ã¨è¨è¿°ãããã¨ãã§ãã¦ä¾¿å©ã§ããããhogeã¤ã³ã¿ã¼ã»ãã¿ã¼ã»ã¹ã¿ãã¯ã« fileUpload ã¤ã³ã¿ã¼ã»ãã¿ã¼ãç¡ãã¦ãã¨ã©ã¼ã«ãªããªãã®ã§æ³¨æãå¿ è¦ã ãåå¨ããªãã¤ã³ã¿ã¼ã»ãã¿ã¼åã§ããã°è¦â¦
Struts2ã®OGNLã§ã®NestããMapã¸ã®ã¢ã¯ã»ã¹ã§å°ãèºããã <s:set name="nestmap" value="#{ 'a' : #{ 'A' : 'aa', 'B' : 'bb' }, 'b' : #{ 'A' : 'cc', 'B' : 'dd' } }"/>ãã®ãããªNestããMapããã£ãã¨ãã¦ãããã«ã¢ã¯ã»ã¹ããå ´å次ã®ã©ãã§ãã¢ã¯ã»ã¹ã§ãã <s:property value="#nestmap.a.A"/> <s:property value="#nestmap['a'].A"/> </s:property></s:property></s:set>
Springã®with dependencyããã±ã¼ã¸ã¯é¢é£ããJarãå«ã¾ãã¦ãã¦ä¾¿å©ã ããSpring2.5.5ä»å±ã®iBATISã¯2.3.2ã¨ãªã£ã¦ãã¦ããã®ãã¼ã¸ã§ã³ã«ã¯å¯åãåããã§ã®ãã°ãããã å¯åãåããæå®ã®SQLãå®è¡ããã¨æ¬¡ã®ãããªã¨ã©ã¼ãåºåããã¦ãã¾ãã javax.seâ¦
è¤éãªã¢ã¯ã·ã§ã³ã®çµæã§ãã¾ãæ´æ°ãããªããã®ã«é¢ãã¦ã¯ãã£ãã·ã¥ãããããã«ãããããã¢ããªããã¯ééã§ç´°ãããã¨ãæ°ã«ãã使ãããããªãã£ãã·ã¥ãã¬ã¼ã ã¯ã¼ã¯ã調æ»ä¸ãJSPã®ã«ã¹ã¿ã ã¿ã°ã®ãããªå®è£ ã便å©ããã ãs:actionã§å é¨çã«ã¢ã¯ã·â¦
Struts2ã«ã¯Profilingã®ä»çµã¿ãæ¨æºç¶æ ã§çµã¿è¾¼ã¾ãã¦ããã®ã§ãããå©ç¨ãã¦ã¤ã³ã¿ã¼ã»ãã¿ã¼ãã¢ã¯ã·ã§ã³ã§ã©ãã ãæéãæã£ã¦ããã測å®ãããã¨ãã§ããã profilingãããã¨ã«ãã£ã¦ãã¢ã¸ã¥ã¼ã«åããã¦ãã¦ï¼ãªã¯ã¨ã¹ãã§è¤æ°ã®ã¢ã¯ã·ã§ã³ãå®è¡â¦
Struts2ã®s:checkboxlistã«é åã渡ãã°ãè¤æ°é¸æå¯è½ãªcheckboxãç°¡åã«åºåã§ãããããããå ¨ã¦ãï¼è¡ã«åºã¦ãã¾ãã®ã§è¦ç´ æ°ãå¤ãå ´åã«å ·åãè¯ããªãã次ã®ããã«è¨è¿°ããã¨ç°¡åã«ä¸è¡ã®åºåè¦ç´ æ°ã調æ´ã§ãããå ã®JSPã¯ãããªæãã§åºåãã¦ããâ¦
Struts2ã®JSPã§åºåã«Tilesã®ã¬ã¤ã¢ã¦ããé©ç¨ããã¨ãå©ç¹ã¨ãã¦ã¬ã¤ã¢ã¦ãå¤æ´ã«å®¹æã«å¯¾å¿ã§ããã¨ããç¹ã¯ããã«åãããå®ã¯ãã£ã¨å¤§ããªå©ç¹ãããã
Struts2ã®JSPã«ã¹ã¿ã ã¿ã°ä¸ãªã©ã§å©ç¨ã§ããOGNLå¼ã¯ã³ã¬ã¯ã·ã§ã³ã«å¯¾ãã¦ä¾¿å©ãªæä½ãç°¡åã«è¡ãããã³ã¬ã¯ã·ã§ã³ããã®æ¡ä»¶æ½åºã次ã®ããã«ãã¦å®ç¾ã§ããã ã³ã¬ã¯ã·ã§ã³.{? æ¡ä»¶ }ããã§æ¡ä»¶ã«ä¸è´ããè¦ç´ ã®ã¿ã§æ§æãããã³ã¬ã¯ã·ã§ã³ã¨ãªãã次ã®ãâ¦
Struts2ã®å種ãã¡ã¤ã«ã§å©ç¨ã§ããOGNLå¼ã§ãinå¥ã使ãã¨ã³ã¬ã¯ã·ã§ã³ä¸ã§ã®è¦ç´ ã®åå¨ãç°¡åã«èª¿ã¹ããã¨ãã§ããJSPã®å ´å次ã®ãããªãªã¹ãããã£ãã¨ã㦠<s:set name="list1" value="{ 'item1', 'item20', 'item300', 'item4000' }"/> ãã®çµæ㯠item2:[<s:property value="'item2' in #list1"/>]<br> item20:[<s:property value="'item20' in #list1"/>]<br> item200:[</s:property></s:property></s:set>
Struts2ã®OGNLã§ã³ã¬ã¯ã·ã§ã³ã®å°å½±ã容æã«ä½æã§ãã ã³ã¬ã¯ã·ã§ã³.{ æä½ }ã§æ°ããã³ã¬ã¯ã·ã§ã³ãè¿ãããã{ }å ã§ã¯ #thisã§ç¾å¨è¦ç´ ãåç §ã§ãããä¾ãã°æååã®ãªã¹ãããã£ãã¨ãã¦ãåè¦ç´ ã®å¾ã« " ({æååé·})"ã®ãããªæååãä»å ãããªã¹ãâ¦
Struts2ã®s:generatorã¿ã°ã使ãã¨æ¬¡ã®ããã«ãã¦é åãçæã§ããã <s:generator separator="|" val="'a|b|c|d|e|f'"> <s:set name="lst" value="top"/> </s:generator> ãã㯠<s:set name="lst" value="{ 'a', 'b', 'c', 'd', 'e', 'f' }"/> ã¨åãçµæã«ãªãããã®é åã¯ä¾ãã°Struts2ã®s:selectã¿ã°ã®è¦ç´ ã«æå®ã§ãã <s:select list="lst" name="selecttest1"/> s:generatorâ¦</s:select></s:set>
Struts2ã®prepareã¤ã³ã¿ã¼ã»ãã¿ã¼ãå©ç¨ããã¨ã¡ã½ããå®è¡åã«å¦çãè¡ããããã¨ãã§ããããã«ãªãã å®è¡ããã¡ã½ããã«ãã£ã¦åå¦çã§è¡ãå 容ãå¤æ´ãããå ´åã¯ãstaticParamsã§ãã©ã¡ã¼ã¿ãæ³¨å ¥ãã¦ãããããã®å¤ã§æ¯ãåãããããªãã¨ãèãã¦ãâ¦
GWTã§éçºãããã¯ã©ã¤ã¢ã³ãå´ã®ã³ã¼ãã¯æçµçã«JavaScriptã«å¤æããå¿ è¦ãããããHsotedã¢ã¼ããã©ã¦ã¶ã®Compile/Browseãã¿ã³ã§çæãããã³ã¼ãã¨ã³ãã³ãã©ã¤ã³ã§ã³ã³ãã¤ã«ãã¦çæããã³ã¼ãã§ã¯å 容ãç°ãªãã®ã§æ³¨æãå¿ è¦ã ãHostedã¢ã¼ããã©ã¦â¦
iBatisã®SQLè¨å®ãã¡ã¤ã«ã§æ¬¡ã®ããã«ãã¦çµæãã£ãã·ã¥ã®æå®ãã§ãã <cacheModel id="test.cache" type="LRU"> <flushInterval hours="24"/> <flushOnExecute statement="test.refresh"/> <property name="size" value="200"/> </cacheModel> ããã¯LRUã§æ大24æéã200件ã®ãã£ãã·ã¥ãè¡ãæå®ã¨ãªããã¾ããã£ãã·ã¥ãç¡å¹ã«ããæ¡ä»¶ã¨ã㦠test.refreshãæå®ãã¦ããããã¨ã¯ãã®ãã£ãã·ã¥è¨å®ãé©ç¨ããselectã§câ¦
Struts2ã® 2.0.11.2 ããªãªã¼ã¹ããã¦ãã¾ããã»ãã¥ãªãã£ã¢ãããã¼ãã§ãã®ã§å ¥ãæ¿ãã¦ããã¾ããããhttp://jira.opensymphony.com/secure/ViewIssue.jspa?key=XW-641ãã¦ã³ãã¼ãã¯ãã¡ããã http://struts.apache.org/download.cgi#struts20112
iBatisã§ï¼å¯¾å¤ã®ãã¼ãã«ããã®åå¾ãªã©ã®å ´åã«ãµãã¯ã¨ãªã®æå®ã¯æ¬¡ã®ããã«è¡ãã <result property="history" column="id" select="getHist"/> ããã§ã getHist ã®SQLä¸ã§ id ã®å¤ã¯ #value# ã§åç §ã§ããããã«ãªãããµãã¯ã¨ãªã«æ¸¡ãå¤ãä¸ã¤ã§è¶³ããå ´åã¯åé¡ãªãããè¤åãã¼ãªã©ã®å ´åã«é§å表ã®è¤æ°ã«ã©ã </result>â¦
Eclipseã®JSPã¨ãã£ã¿ã«ã¯æ¨æºç㨠Amaterasçãããã以åã®ã¨ã©ã¼åé¿æ¹æ³(Eclipseã®JSPã¨ãã£ã¿ã§Struts2ã®ã¿ã° - Struts 2+Spring 2+Tiles+Acegi+iBatis+GWT+JUnit 4+JMockit ã§ãã«ã¹ã¿ãã¯JAVAãã¬ã¼ã ã¯ã¼ã¯)ã¯æ¨æºJSPã¨ãã£ã¿ã®å ´åã«ããæå¹ã§ã¯ãªâ¦
以åresultMapã®åãHashMapã«ããæ¹æ³ãç´¹ä»ãã çµæãMapã§åãåã - Struts 2+Spring 2+Tiles+Acegi+iBatis+GWT+JUnit 4+JMockit ã§ãã«ã¹ã¿ãã¯JAVAãã¬ã¼ã ã¯ã¼ã¯ ããä»åã®ã¯çµæãListã§ã¯ãªããMapã«ããæ¹æ³ã queryForListã§ã¯ãªãqueryForMapâ¦
Tomcatã® web.xml ã« wellcome-file ã®è¨å®ããã¦ããã¨ããã£ã¬ã¯ããªåã§ã¢ã¯ã»ã¹ãããå ´åãªã©ã«æå®ã®actionãå®è¡ããããã¨ãåºæ¥ãã <welcome-file-list> <welcome-file>index.do</welcome-file> </welcome-file-list> ãã ããããã ãã§ã¯æå³ã©ããã«æ©è½ããªãããã㯠tomcat ããã¯ãããªactionãå®å¨ããããããâ¦
Struts2ã®ã¢ã¯ã·ã§ã³ãSpringã§Beançæãããã¨ãã«ä»¥å "request"ã¹ã³ã¼ãã使ç¨ãã¦ããï¼Struts2ã®Actionå°ç¨ã®ã¹ãã£ã³ç¨Annotationãä½ã - Struts 2+Spring 2+Tiles+Acegi+iBatis+GWT+JUnit 4+JMockit ã§ãã«ã¹ã¿ãã¯JAVAãã¬ã¼ã ã¯ã¼ã¯ï¼ããs:actioâ¦
Java5 ã§ã¯ interface ã®ã¡ã½ããã®å®è£ ã« @Override ãä»ããã¨ã¨ã©ã¼ã¨ãªã£ã¦ãã¾ããã Java6 ã§ã¯ã¨ã©ã¼ã«ãªããªããªã£ããStruts2ã®ä»çµã¿ã®ãããªå ´å @Override ãä»ããã®ã¯å¿ é ã ã¨æããä¾ãã°ãããã¢ã¯ã·ã§ã³ã§ public class Foo implements Sesâ¦
Struts2ã®Tagã® s:subset ã¯ãªã¹ãã®ä¸é¨åãåãåºãæã«å©ç¨ããã s:incldueã¨çµã¿åããã¦å©ç¨ããã¨æ¡ä»¶ã«ãã£ã¦ï¼æ®µçµã¾ãã¯ï¼æ®µçµã«ãããå ´åãªã©ã§ä¾¿å©ã«ä½¿ããããªã¹ãè¦ç´ ãåç´ã«åºåããã¨ãã¦ã s:include ã§åãè¾¼ã¾ããå´ã«ã¯ç´ç²ãªï¼æ®µåã®â¦
OGNLã§ãªã¹ããçæããå ´åããªã¹ãã®æå¾ã®è¦ç´ ã«ä½å㪠","ãä»ãã¦ããã¨ãªã¹ãã«ãªã£ã¦ãããªãã次ã®ããã«æ¸ãã®ã¯'label2'ã®å¾ã® "," ãä½åã ããNG㧠<s:set name="listitem" value="#{ '1':'label1', '2':'label2', }" /> <s:set name="listitem" value="{ 'label1', 'label2', }" /> 次ã®ããã«æ¸ãã°OKã ã£ã <s:set name="listitem" value="#{ '1':'label1', '2':'label2' }" /> </s:set></s:set></s:set>
Struts2ã®s:includeã¯ä¾¿å©ã«ä½¿ããã®ã ãããã°ããã£ãã8192ãã¤ãã®å¢çã«è¤æ°ãã¤ãã®UTF-8æåè·¨ã£ããã®ãincludeããã¨ãã®æåãåãã¦ãã¾ãã¨ããåé¡ã ãã㯠s:incldueã®å é¨ã§ä½¿ç¨ãã¦ãã FastByteArrayOutputStream ã¨ããã®ãUTF-8è¤æ°ãã¤â¦
Struts2ã®s:actionã§å¼ãã å ã«ååã¤ãã§ãã©ã¡ã¼ã¿ã渡ãæ¹æ³ã¨ã㦠<s:set name="" value="#request.namedParam='test'"/> ã®ãããªæ¹æ³ãæããããs:setã«ã¯ã¹ã³ã¼ãæå®ãããã®ã«æ°ãä»ãã¾ããã <s:set name="namedParam" value="'test'" scope="request"/> ã¨æ¸ããã»ããã¹ãããªãã¾ããåç §ã®ä»æ¹ã¯ã©ã¡ãã <s:property value="%{ #request.namedParam }"/> ã§OKã</s:property></s:set></s:set>