如何在 struts2 中映射长 REST url - 使用 struts2 rest 插件 [英] How to map long REST urls in struts2 - using struts2 rest plugin

查看:33
本文介绍了如何在 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 插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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