设置特定上下文根时的struts2命名空间配置 [英] struts2 Namespace configuration when set a specific context-root

查看:121
本文介绍了设置特定上下文根时的struts2命名空间配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在weblogic.xml中为我的应用程序设置上下文根时,struts2中软件包的默认名称空间是什么?

When I set a context-root in weblogic.xml for my application, what is the default namespace for package in struts2?

例如: 我设置了<context-root>/home/app/exec</context-root>,并使用以下uri访问了我的应用程序:localhost:8081/home/app/exec/index.html插入了localhost:8081/NameOfMyApp/index.html

ex: I set <context-root>/home/app/exec</context-root> and I access my app with the following uri: localhost:8081/home/app/exec/index.html insted of localhost:8081/NameOfMyApp/index.html

另一方面,我知道在Struts2中,动作名称空间映射到文件夹结构. 以下链接上的示例: https://www .mkyong.com/struts2/struts-2-namespace-configuration-example-and-explanation/

In the other hand I Know that in Struts2 action namespace map to folder structure. Example on the following link: https://www.mkyong.com/struts2/struts-2-namespace-configuration-example-and-explanation/

ServletContext不是我的应用程序名称而是上下文根的情况下,正确的命名空间是什么?

What is the correct namespace for the situation in case that ServletContext is not the name of my app but is the context-root?

推荐答案

命名空间是在上下文路径之后和操作名称之前计算的部分.另一方面,名称空间是包的属性,其中包含属于该名称空间的动作.默认操作映射器使用这两个属性来查找与名称空间和操作名称相对应的操作配置.

Namespace is the part that is calculated after the context path and before the action name. On the other hand a namespace is an attribute of the package that holds the actions belonging that namespace. A default action mapper is using both attributes to find the action config corresponding the namespace and action name.

有关默认操作映射器的详细说明,您可以阅读javadocs

For detailed explanation of default action mapper you can read javadocs DefaultActionMapper.

您可以阅读有关操作配置 ActionMapper .

您还应该知道操作映射器返回 ActionMapping .但是,要执行操作,需要 ActionConfig ,由Struts使用运行时配置确定.

You should also know that the action mapper returns ActionMapping. However, to execute an action requires ActionConfig which is determined by the Struts using run-time configuration.

这篇关于设置特定上下文根时的struts2命名空间配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆