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 插件
基础教程推荐
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- 将 double 转换为 Int,向下舍入 2022-01-01
- JPA惰性列表上的流 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
