Ʊ¤¸¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹¤Ç½èÍý¤òÀÚ¤êÂØ¤¨¤ë †<action path="/showSetting" forward="/setting.do?action=show" /> <action path="/editSetting" forward="/setting.do?action=edit" /> <action path="/setting" type="kino.actions.SettingAction" > <forward name="show.success" path=".tiles.showSetting" /> <forward name="edit.success" path=".tiles.editSetting" /> </action> ¤Æ¤ä¤Ã¤Æ¡¢request.getParameter("action") ¤ÇÀÚ¤êÂØ¤¨¤ë Ʊ¤¸¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹¤Ç¡¢Á«°ÜÀè¤òÀÚ¤êÂØ¤¨¤ë †½èÍý¤¬¤Û¤È¤ó¤ÉƱ¤¸¤ÇURL¤ò¤¤ê¤«¤¨¤ë¤À¤±¤Ê¤é <action path="/showSetting" type="kino.actions.SettingAction" > <forward name="success" path=".tiles.showSetting" /> </action> <action path="/editSetting" type="kino.actions.SettingAction" > <forward name="success" path=".tiles.editSetting" /> </action> ¤Æ¤ä¤ì¤Ð¤è¤¤¡£¡£ action¥¿¥°¤Îparameter¤Ë¥¢¥¯¥»¥¹¤¹¤ë¡£ †struts-config.xml ¤Ë <action path="/setting" type="kino.SettingAction" parameter="hoge" /> ¤È¤·¤¿¤È¤¤Îparameter¤ÎÃͤËAction¥¯¥é¥¹¤«¤é¥¢¥¯¥»¥¹¤¹¤ëÊýË¡¡£ String parameter=mapping.getParameter(); <- mapping¤ÏActionMapping ¥¹¥¿¥¤¥ë¥·¡¼¥È¤Î»ØÄêÊýË¡ †¥Ç¥£¥ì¥¯¥È¥ê¹½À®¤¬[contextroot]/css/stylesheet.css¤Ã¤Æ¤Ê¤Ã¤Æ¤ë»þ¡£ <link href="<html:rewrite page='/css/stylesheet.css'/>" rel="stylesheet" type="text/css"/> ¤¬¥¥ì¥¤¤Ç¤¹¤Í¡£¥â¥¸¥å¡¼¥ë²½¤·¤Æ¤¤¤ë¾ì¹ç¤Ï»È¤¨¤Þ¤»¤ó¤¬*1¡£ ¤è¤ê¤è¤¤¤Î¤Ï struts-config.xml ¤Ë <global-forwards> <forward name="stylesheet" path="/theme/Master.css"/> </global-forwards> ¤È½ñ¤¤¤Æ¡¢jsp¤Ë <link href="<html:rewrite forward='stylesheet' />" rel="stylesheet" type="text/css"/> ¤Èglobal-foward¤ò»²¾È¤¹¤ë¤Î¤¬¤è¤¤¤Ç¤¹¤Í¡£ ¥ê¥¯¥¨¥¹¥È¥Ñ¥é¥á¡¼¥¿¤«¤é¡¢ÊÑ¿ô¤òÄêµÁ †¤¢¤ë¥¹¥³¡¼¥×¤«¤éÊÑ¿ô¤òÄêµÁ¤¹¤ë¤Î¤Ïbean:define¤Ç¤Ç¤¤Þ¤¹¤¬¡¢¥Ñ¥é¥á¡¼¥¿¤«¤é¤ÏÊÑ¿ôÄêµÁ¤Î»ÅÊý¤òÃΤê¤Þ¤»¤ó¤Ç¤·¤¿¡£¤è¤¦¤¹¤ë¤Ë hoge=request.getParameter("HOGE");
¤ò¤·¤¿¤¤¤Î¤Ç¤¹¤¬¡¢¤è¤¦¤ä¤¯¤ï¤«¤ê¤Þ¤·¤¿¡£ <bean:parameter id="hoge" name="trackbackUrl"/> ¤È <% String hoge=(String)request.getParameter("trackbackUrl"); %>
¤ÏƱ¤¸°ÕÌ£¤Ç¤¹¤Í¡£ÅöÁ³<%=hoge%>¤â¤Ç¤¤Þ¤¹¡£trackbackUrl¤Ã¤Æ¥Ñ¥é¥á¡¼¥¿¤¬¤Ê¤«¤Ã¤¿¤È¤¤Ë¥¨¥é¡¼¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢¤½¤ì¤¬¤¤¤ä¤Ê¾ì¹ç¥Ç¥Õ¥©¥ë¥ÈÃͤò»ØÄꤷ¤Þ¤¹¡£ <bean:parameter id="hoge" name="trackbackUrl" value=""/> ¥¹¥³¡¼¥×¤«¤é¤È¤ì¤Æ¤â¡¢<%=hoge%>¤Ç¤¤ë¤ï¤±¤¸¤ã¤Ê¤¤ †¤Ê¤ó¤À¤«¤ï¤«¤Ã¤Æ¤ë¿Í¤Ë¤ÏÅö¤¿¤êÁ°¤Î¤³¤È¤Ê¤Î¤«¤â¤·¤ì¤Þ¤»¤ó¤¬¡¢¤¤¤«¤ó¤»¤ó½é¿´¼Ô¤Ê¤â¤ó¤Ç¡¢½ñ¤Î±¤á¤Æ¤ª¤¤Þ¤¹¡£ <logic:present name="hoge" > <bean:write name="hoge"/> </logic:present> <%=hoge%> ¤ÎºÇ¸å¤Î¹Ô¤Ï¡¢¥³¥ó¥Ñ¥¤¥ë¥¨¥é¡¼¤Ë¤Ê¤ê¤Þ¤¹¡£<bean:define .../>¤·¤¿¤È¤¤ÏÂç¾æÉפʤ櫓¤Ç¤¹¤¬¡¢¤³¤ì¤Ïdefine¥¿¥°¤¬ÊÑ¿ôÄêµÁ¤Þ¤Ç¤ä¤Ã¤Æ¤ë¤ó¤Ç¤·¤ç¤¦¤Í¡£¥½¡¼¥¹¤ò¸«¤ë¤È pageContext.setAttribute(id, value, inScope); ¤Ã¤Æ¤ä¤Ã¤Æ¤Þ¤¹¤Í¡£*2 ¥¢¥¯¥·¥ç¥ó¥Þ¥Ã¥Ô¥ó¥°¤Îattribute¤Î°ÕÌ£ †Ä̾FormBean?¤Ï¥¢¥¯¥·¥ç¥ó¥Þ¥Ã¥Ô¥ó¥°¤Îname°À¤ÎÃͤǥ¹¥³¡¼¥×¤Ë³ÊǼ¤µ¤ì¤Þ¤¹¡£ ¤¿¤È¤¨¤Ð <action name="inputForm" path="/execute".... ¤È¤¹¤ë¤È¡¢ session.getAttribute("inputForm");¤ä
<bean:write name="inputForm"/>
¤¬¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£¤É¤¦¤â¥Ç¥Õ¥©¥ë¥È¤Î³ÊǼ¥¹¥³¡¼¥×¤Ï¥»¥Ã¥·¥ç¥ó¤ß¤¿¤¤¤Ç¤¹¡£*3 <action name="inputForm" path="/execute" attribute="otherForm".... ¤È¤¹¤ë¤È¡¢<bean:write name="otherForm"/>¤ÇÃͤò¼èÆÀ¤Ç¤¤Þ¤¹¡£ ¥×¥í¥Ñ¥Æ¥£¤ÏÊÝ»ý¤µ¤ì¤ë †<html:text property="userid" /> ¤Ï²èÌ̤¬ÀÚ¤êÂØ¤ï¤Ã¤Æ¤â¥Ñ¥é¥á¡¼¥¿¤¬ÊÝ»ý¤µ¤ì¤Æ¤Þ¤¹¤è¤Í¡£ bean:write †<bean:write name="username"/> ¤Ïxxxx.getAttribute("username") ¤·¤Æ¼èÆÀ¤·¤¿¥¤¥ó¥¹¥¿¥ó¥¹¤ÎtoString()¤ò²èÌ̤˽ñ¤½Ð¤¹¤ß¤¿¤¤¤Ç¤¹¡£*4 logic:present †<logic:present name="username"> <bean:write name="username"/> </logic:present> ¤È¤¤¤¦¤è¤¦¤Ëlogic:present¤Ç°Ï¤Þ¤Ê¤¤¤Èusername¤¬¥³¥ó¥Æ¥¥¹¥È¤Ë¤Ê¤¤¤È¤¤Ë¥¨¥é¡¼¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£¤è¤¦¤¹¤ë¤Ëxxx.getAttribute("username");¤¬null¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤¿¤á¤Î¥¤¥Ç¥£¥ª¥à¤Ç¤¹¡£ bean:define †<bean:define id="user_name" name="username"/> <bean:write name="user_name"/> <%=user_name%> ¤È¤¹¤ë¤È¡¢ user_name = xxx.getAttribute("username");
¤È¤¤¤Ã¤¿¤³¤È¤¬¹Ô¤ï¤ì¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢¥¹¥³¡¼¥×¤«¤é¥¤¥ó¥¹¥¿¥ó¥¹¤ò(name°À¤Î̾¾Î¤Ç)¼è¤ê½Ð¤·¡¢(id¤Ç»ØÄꤷ¤¿Ê¸»úÎó¤Î)ÊÑ¿ô¤òÄêµÁ¤·¤Þ¤¹¡£ <bean:define id="user_name" value="username"/> ¤È¤¹¤ë¤È¡¢user_name¤È¤¤¤¦ÊÑ¿ô¤Ë"username"¤È¤¤¤¦¡Öʸ»úÎó¡×¤¬³ÊǼ¤µ¤ì¤Þ¤¹¡£ bean:size †<bean:size id="count" name="username" /> <bean:write name="count"/> <%=count%> ¤È¤¹¤ë¤È¡¢ int count = xxx.getAttribute(username).size(); ¤ß¤¿¤¤¤Ê¤³¤È¤¬¹Ô¤ï¤ì¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢¥¹¥³¡¼¥×¤«¤é¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼è¤ê½Ð¤·¡¢¤½¤ì¤¬Collection¤Î¾ì¹ç¤ËÍ×ÁÇ¿ô¤òÊÖ¤·¤Þ¤¹¡£*5 ¥¯¥¨¥ê¤òÄɲä¹¤ë †<html:link action="/execute" paramId="userid" paramName="userID">¸¡º÷</html:link> ¤Ã¤Æ¤ä¤ë¤È¡¢ execute.do?userid=[userID¤ÎÃÍ] ¤È¤Ê¤ë¡£userID¤Ã¤Æ¤Î¤Ïxxx.getAttribute("userID");¤Î¤³¤È(³Î¤«)¡£ logic:empty †<logic:empty name="userid"> ¤Ï..¡£¤Ê¤ó¤À¤Ã¤±¡© ApplicationResources?.properties ¤Ë¥¢¥¯¥»¥¹¤¹¤ë †<bean:message key="app.title"/> <bean:write>¥¿¥°¤Îignore°À †<bean:write>¥¿¥°¤Îignore°À¤òtrue¤Ë¤·¤Æ¤¤¤ë¾ì¹ç¡¢¥á¥Ã¥»¡¼¥¸¤¬¤Ê¤¤¾ì¹ç¤Ï²¿¤âɽ¼¨¤µ¤ì¤Ê¤¤¡£ ¥¿¥°¤òxhtml¤ËÂбþ¤¹¤ë †¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢Struts¤Î¥¿¥°¤Ïxhml¤ËÂбþ¤·¤Æ¤¤¤Ê¤¤(ÊĤ¸¥¿¥°¤È¤«)¡£ <html:html xhtml="true"> ¤È¤¹¤ë¤³¤È¤Ç¡¢xhtml·Á¼°¤Î¥¿¥°¤ò½ÐÎϤ·¤Þ¤¹¡£¤Ã¤Ætiles»È¤¦¤Èinclude¤µ¤ì¤ë¦¤¬¤½¤¦¤Ê¤é¤Ê¤¤µ¤¤¬¤¹¤ë¤ó¤Ç¤¹¤±¤É¡£¡£ ½é´ü¥¢¥¯¥»¥¹¤Î¥Ñ¥é¥á¥¿¥¨¥é¡¼¤ò²óÈò¤¹¤ë †¤¿¤È¤¨¤Ð²¿¤«¤ò¸¡º÷¤¹¤ë²èÌÌ(JSP)¤Ç¡¢ºÇ½é¤Ë¤½¤Î²èÌ̤ò³«¤¤¤¿¤È¤¤Ï¸¡º÷¥Ñ¥é¥á¡¼¥¿¤¬¤Î¤Ã¤Æ¤Þ¤»¤ó¤è¤Í¡£¸¡º÷¥Ñ¥é¥á¡¼¥¿¤ò²èÌ̤Ëɽ¼¨¤·¤Æ¤¤¤ë¾ì¹ç¡¢ºÇ½é¤Î¥¢¥¯¥»¥¹¤À¤±¥¨¥é¡¼¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ê¥í¥¸¥Ã¥¯¤¬É¬Íפˤʤꤽ¤¦¤Ç¤¹¤¬¡¢¤³¤ó¤Ê²óÈòË¡¤¬¤¢¤ê¤Þ¤·¤¿¡£²¿¤Î¤³¤È¤Ï¤Ê¤¤¡¢¥Ñ¥é¥á¥¿¥Á¥§¥Ã¥¯¤òÆþ¤ì¤Æ¤¤¤ë¤À¤±¤Ç¤¹¤¬¡¢¤³¤ó¤Ê´¶¤¸¤Ç¤ä¤ë¤È¥¥ì¥¤¤Ë¤Ê¤ê¤Þ¤¹¤Í¡£ ¤³¤Á¤é¤Ï¸¡º÷¦¤Îµ½Ò <html:form action="/search"> <html:text property="input" /> <html:submit>Á÷¿®</html:submit> </html:form> ¤³¤Á¤é¤¬É½¼¨Â¦¤Îµ½Ò <logic:present name="input"> ÆþÎÏÃÍ: <bean:write name="input" /> </logic:present> ¤Á¤Ê¤ß¤Ë¡¢²¼¤Îinput¤Ïrequest.getParameter("input");¤Ç¤Ï¤Ê¤¯¡¢xxxx.getAttribute("input")*6;¤Ç¤¢¤ë¤³¤È¤ËÃí°Õ¡£ ¤³¤Îµ»ö¤Ï
¸½ºß¤Î¥¢¥¯¥»¥¹:50858 |