Apache Struts2Ô¶³Ì´úÂëÖ´ÐÐÎó²î£¨S2-057£©

Ðû²¼Ê±¼ä 2018-08-22
Ò»¡¢Îó²îÐÎò



        2018Äê8ÔÂ22ÈÕ £¬Apache StrutsÐû²¼×îÐÂÇ徲ͨ¸æ £¬µ±Struts.xmlÎļþ½«struts.mapper.alwaysSelectFullNamespace¸ÃÑ¡ÏîÉèÖÃΪtrue £¬²¢ÇÒpackage±êÇ©Ò³ÒÔ¼°resultµÄparam±êÇ©Ò³µÄnamespaceÖµµÄÊôÐÔȱʧʱ¿ÉÔì³Énamespace±»¿ØÖÆ £¬namespace±»´øÈëognlÓï¾äÖ´ÐÐ £¬±¬·¢Ô¶³Ì´úÂëÖ´ÐÐÎó²î¡£



Ïà¹ØÁ´½ÓÈçÏ£º



https://cwiki.apache.org/confluence/display/WW/S2-057


¶þ¡¢Îó²îÆÊÎö


        ´úÂëÎÊÌâ³öÔÚDefaultActionMapperÕâ¸öÀàµÄparseNameAndNamespaceÒªÁìÀïÈçÏÂͼËùʾ£º



ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


        µ±alwaysSelectFullNamespace±»ÉèÖÃΪtrueʱ £¬namespaceµÄÖµ´ÓuriÖлñÈ¡ £¬ÎÒÃÇÖªµÀuriÊǿɿصÄ £¬ÒÔÊÇÕâ¾ÍÖ±½Óµ¼ÖÂÁËnamespace¿É¿Ø¡£×îÖÕ»áŲÓÃTextParseUtil.translateVariablesÒªÁìÆÊÎöOgnlÓï¾ä¡£


        ½«namespaceÎÛȾΪ$£¨100*100£©¡£ÀÖ³ÉʹÓúóЧ¹ûÈçÏÂͼËùʾ£º



ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


        OgnlÓï¾äÀÖ³ÉÆÊÎö¡£


Èý¡¢Îó²îÓ°Ïì


        1¡¢ÊÜÓ°Ïì°æ±¾£ºApache Struts 2.3 - Struts 2.3.34 £¬ Apache Struts 2.5 - Struts 2.5.16


        2¡¢²»ÊÜÓ°Ïì°æ±¾£ºApache Struts 2.3.35 or Apache Struts 2.5.17


ËÄ¡¢¹æ±Ü¼Æ»®


        1¡¢Éý¼¶µ½Struts 2.3.35 or Struts 2.5.17×îа汾¡£


        2¡¢ÐÞ¸ÄstrutsÉèÖÃÎļþ £¬½«alwaysSelectFullNamespaceÊôÐÔÉèÖÃΪfalse¡£ÈçÏÂËùʾ£º


               


        3¡¢package±êÇ©ÒÔ¼°result±êÇ©ÒªÉèÖÃÀο¿namespace±êÇ© £¬Õ¥È¡Ê¹ÓÃͨÅä·û¡£×¼È·ÉèÖÃÒªÁìÈçÏÂͼËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢