问题标签 [struts2-json-plugin]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1615 浏览

struts2 - 使用json插件时带参数的Struts2注释

只是我想评估我的操作的属性并在注释中使用它的值。以下正是我想要使用它的地方。

我想在运行时定义一个 excludeProperties 参数。

考虑以下当前适用于该操作的注释:

那里的动作模型有一个我不想序列化的 myCollection 集合。

但是我想创建一个排除字符串(现在可以使用一个字符串)。

如果我创建一个用于排除的 getter setter,我希望以下注释能够工作(它不起作用):

有任何想法吗?

我创建了类似于此答案的操作,它显示了在注释中解析参数。我正在使用命名变量模式匹配器从命名空间中提取值......但无论我做什么,我似乎都无法设置这个参数。

0 投票
0 回答
407 浏览

ajax - AJAX Call Not Working with Struts2 Spring Plugin

I have a project with Struts2 + Struts2 JQUery + JQ Grid + Struts2 JSON Tags. The project works perfectly and i am able to do most of the JQuery features with AJAX from tabbed panel to Grid. I have multiple struts config file and they are all called from sj: a tags.

But the problem starts when I add the Spring Plugin.

  1. The Submit returns null values to the Action Class.
  2. I have a Tabbed Panel which is created from 'struts-jquery-tags' and on onload calls the action class. If I use Auto wired on the Constructor in the action class only that is getting called and the action method is not getting called at all. As a result the jsp is not getting rendered.

If I remove the Spring plugin, everything works just fine. I am trying hard to overcome this issue but I have no success.

I have Struts 2.3.3 / Spring 3.0.5 / aspectweaver / Struts2Jquery 3.3.3 jars.

Can someone advice ? I have followed jgeppert examples in showcase app.

0 投票
2 回答
2594 浏览

java - Struts2 REST 插件:通过 PUT 发送 JSON 对象

我正在用 Struts2 和 Struts2 REST 插件编写一个 RESTful 服务。目前,我的服务能够毫无问题地处理 GET 请求,但我一直试图让它“更新”(PUT)请求工作。

我有两个可能的模型,一个用于 show() 的 List 和一个用于 update() 的 ClientFeature 对象,其中 ClientFeature 是一个 pojo 类。

休息控制器:

客户端功能:

并且正在使用 Postman 的 chrome 扩展来测试服务,并通过 JSON 数据发送类似于:

和错误:

我对所有相关的东西都很陌生,所以任何帮助都将不胜感激。

编辑:

尝试发送以下 JSON:

{ "com.foo.entity.clientFeature" : {"clientId":10} }

并得到以下完整错误:

0 投票
2 回答
3603 浏览

java - struts2-rest-plugin:将 json 数据发送到 PUT/POST

我一直在尝试使用 struts2-rest-plugin 将 JSON 数据发送到 Struts2 REST 服务器。

它适用于 XML,但我似乎无法找出正确的 JSON 格式来发送它。

有人有这方面的经验吗?

谢谢,肖恩

更新:

对不起,我不清楚。问题是 Struts2 似乎没有将我发送的 JSON 数据映射到控制器中的模型。

这是代码:

控制器:

这是我提出请求的 URL:

..http://localhost:8080/coreserviceswrapper/clientfeature.json

-方法:POST 或 PUT(都尝试过,POST 映射到 create(),PUT 映射到 update()) -Header:Content-Type:application/json

有效载荷:

当我提出请求时,Struts2 日志中的输出:

我还要补充一点,XML 请求工作得很好:

URL:..http://localhost:8080/coreserviceswrapper/clientfeature.xml 方法:POST/PUT 内容类型:text/xml

有效载荷:

输出:

0 投票
1 回答
881 浏览

struts2 - Struts json结果includeProperties正则表达式不适用于root存在

这个问题已经在struts社区被问过好几次了,场景很简单:如果你指定

在 json 结果定义中,如果我指定一些像这样的正则表达式,includeProperties 将不起作用:

此处提出了正则表达式,普通字段名称也不起作用。

如果我删除根定义,我可以得到 JSON ok,但需要额外的 JSON 遍历,这是不希望的。

那么,有没有办法解决这个问题呢?谢谢。

0 投票
1 回答
936 浏览

jquery - 如何在 sj 下拉选择中提交表单?

我正在使用 Struts 2 jquery 插件的下拉列表。我想提交具有此下拉列表的表单,并希望将目标提供给其他 div。请给出一些想法。提前谢谢你。这是代码:

0 投票
1 回答
452 浏览

struts - 我的动作是用 Struts2 jQuery Plugin 执行

我正在为 ajax 和小部件使用 Struts2 jQuery Plugin 3.2.1。当我使用 sj 动作时,我的动作需要时间来执行。没有 Struts2 jQuery tags ,它工作正常。我在网上搜索,但找不到合适的答案。请分享您的观点。提前致谢。

  • 在本地服务器中它工作正常。

  • sj 动作意味着,当我单击 struts 2 jquery 按钮标签时,它会调用一个动作。

  • 花费时间意味着,目标jsp需要花费时间来加载。

    /li>
0 投票
2 回答
39666 浏览

java - 无法使用修饰符访问 org.springframework.aop.TruePointcut 类的成员 public

我正在使用 Struts 和 Struts JSON 插件开发一个 Spring 应用程序。当我运行应用程序时,它会出现以下错误(在 Firebug 中):

这是完整的堆栈跟踪:

根本原因:

0 投票
1 回答
784 浏览

struts2 - 无法使用 Struts 2 jquery 图表插件 3.4.0 在 json 图中绘制日期值

我正在使用 Struts2 jquery 图表插件 3.4.0。当我使用 json 从 Action 类中获取日期值时,我得到了空白图表。如果我使用简单的操作,那么相同的代码可以正常工作。这是我的jsp代码。

struts.xml 代码

动作类代码:

0 投票
1 回答
393 浏览

jquery - 如何将json结果分配给struts 2中的jsp datepickers?

我正在调用一个动作,它在 JSP 页面中返回 json 作为结果。我的问题是,如何将此 json 结果设置为我的 datepickers 名称变量。我的代码是这样的。

struts.xml 代码是 -

我在 JSP 页面上得到这个。