我发现在使用 Struts 插件“config-browser”进行调试时,我的所有操作都有一个“默认位置”。类似于下面的内容:
Action information - list*
Action name: list*
Namespace:
Action class: listAction
Action method: {1}
Parameters:
Default location: /mysite/list*.action
我想知道这个“默认位置”是什么意思? 我可以改变它吗?我该如何改变它?
顺便说一句:我已经将 web.xml
中的 struts 过滤器更改为仅收听 /test/*
和 /action/*
.我不确定为什么它仍然说“默认位置”是 /mysite/list*.action
。
最佳答案
没有“默认位置”这样的概念。有“默认操作”。
Usually, if an action is requested, and the framework can't map the request to an action name, the result will be the usual "404 - Page not found" error. But, if you would prefer that an omnibus action handle any unmatched requests, you can specify a default action. If no other action matches, the default action is used instead.
如果您查看 ActionMapping
类,您会发现它没有位置属性。相反 ServletDispatcherResult
和 ServletRedirectResult
有这样的参数。因此,将其与映射一起使用可以找出最终位置。
还有计算最终位置时提到的默认命名空间和默认类概念。
此外,术语location 可以被视为路径并映射到配置操作的配置文件。
关于java - 什么是 "default location"用于 Struts 操作(在配置浏览器中)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12946517/