How to map long REST urls in struts2 - using struts2 rest plugin(如何在 struts2 中映射长 REST url - 使用 struts2 rest 插件)
问题描述
过去几天我一直在学习使用 struts2 rest 插件.但是我没有找到如何映射长休息 URL.
I've been learning to use struts2 rest plugin from a past few days. But no-where I found how to map long rest URLs.
例如如果我想映射如下 URL:
For e.g. If I want to map an URL like below :
/profiles/user-test/orders/64/item/4
在哪里
username is user-test
order id is 64
item id is 4
如何将这样的内容映射到 struts2 动作?
How can I map something like this to a struts2 action ?
我在互联网上发现的只是一个正在编辑/显示的单个级别等.但是如果我想在多个级别上显示某些内容 - 那么如何进行?请指导.
All I found on internet is just a single level being edited/displayed etc. But if I want to display something on multiple-level - then how to proceed ? Please guide.
推荐答案
您可以使用 高级通配符映射代码>,没有 REST 插件:
You can do it with Advanced Wildcard Mappings
, without the REST plugin:
/profiles/user-test/orders/64/item/4
用户名是用户测试
订单编号为 64
项目 ID 为 4
此示例所需的操作配置为:
The action configuration needed for this example would be:
<action name="/profiles/{username}/orders/{order}/item/{item}" class="fooBarAction">
<result>fooBar.jsp</result>
</action>
这篇关于如何在 struts2 中映射长 REST url - 使用 struts2 rest 插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 struts2 中映射长 REST url - 使用 struts2 rest 插件


- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01