开发者

Case Sensitivity of Action Names in Struts 2

Is 开发者_高级运维there an easy way to make Struts 2 action names case insensitive? Currently I have the following action defined:

<action name="printTest" class="MyClass" >
  <result name="error">/WEB-INF/jsp/error.jsp</result>
  <result name="input">/WEB-INF/jsp/test.jsp</result>
  <result name="success">/WEB-INF/jsp/test.jsp</result>
</action>

If the user types URL /app/printtest.do instead of /app/printtest.do this action is not executed.

Other then mod_rewrite on the httpd level or something like that, the only option that I know about right now is simply adding the same exact action and changing the name to printtest. Ideally it would be a simple config change to struts.xml.


No configurable option, AFAIK, for case insensitive mapping.

So, I believe you have answered the question yourself: either Apache's mod_rewrite, or write the extra mappings in the config.

You could also write your own ActionMapper, extending DefaultActionMapper (method parseNameAndNamespace() ), but I suspect it would be overkill... :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜