问题标签 [actionform]

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 回答
719 浏览

struts2 - ActionForm pattern in Struts 2

I am migrating a Struts 1 application to Struts 2. In the Struts 2 documentation which it compares the difference it says,

Struts 2 also supports the ActionForm pattern, as well as POJO form objects and POJO Actions.

But i dont find any classes similar to ActionForm or ValidatorForm in Struts 1. So in this case how can I keep the existing ActionForm pattern in Struts 1 with the new Struts 2 jars?

0 投票
1 回答
1727 浏览

jquery - 通过ajax发布表单,Struts ActionForm为空

我正在将 JSP 转换为使用 ajax 发布到操作,但是当请求通过时 ActionForm 是空白的。我不确定发生了什么,因为从我阅读的内容来看,这应该可以正常工作。如果我删除 ajax 页面提交就好了。更新:调试时,数据 var 显示表单的正确字符串。我还添加了 Struts 配置。

HTML:

JS:

Struts 配置:

这是 Struts 1,正如我所说,如果我删除 JS 表单提交方法一切正常,所以我不认为这是我的映射或与 Struts 有任何关系。

0 投票
1 回答
4034 浏览

java - 如何在 Struts 2 中获取 ActionForm?

我正在将一个 Struts 1 应用程序迁移到 Struts2 并尝试最小化所需的代码更改。

我需要知道如何访问ActionFormStruts2Action类。下面是我当前的代码,我在尝试访问时遇到了 NPE ActionForm

到达ActionForm这里的最佳方式是什么?

0 投票
1 回答
1433 浏览

java - Struts ActionForm Lost from Request scope

I've taken over maintenance of a 10-year-old Struts 1.2 application. (It's way too complicated and proprietary to post.)

The application uses a couple of ActionForms which were formerly stored in the session. Because the latest change request requires that we open multiple ActionForms at the same time, I've changed the configuration of the ActionForm from session scope to request scope with struts-config.

This change breaks some custom tag code that looks for the ActionForm within the PageContext object. (And it may break other functionality that we have not been able to test because of this error.)

The code is looking for the ActionForm with TagUtils.getRealValueFromBean

I've tried tweaking parameters in this call to specify the request scope and tried looking within the request object's attributes but the ActionForm is not there! Java code within the JSP shows no such attribute within the Request object. (I've heard that a refresh event can create a new ActionForm but here there's no ActionForm whatsoever within the Request object. And yet, at the bottom of the Action that retrieves the object from the database, the ActionForm is present within the Request object.

I created a small test application with an ActionForm that can be configured in either session or request scope, but the retrieval of the ActionForm from Request works fine!

Any idea of where/how to track down how the ActionForm is getting clobbered?

Or else how to support multiple instances of ActionForm while keeping scope=session?

0 投票
1 回答
368 浏览

jsp - 当两个jsp都有时,如何将一个struts jsp包含在另一个中?

我有 2 个 jsp - jsp1 和 jsp2。每个jsp都有一个定义。

jsp1

jsp2

这是数据流

有什么方法可以在 tab1 中包含 jsp2 吗?它应该如下所示:

我正在寻找一种可以重用jsps、表单和操作的方法,因为现在两个选项卡都需要jsp2。 尝试了几种方法,例如<html:include>, <tiles:insert>, changes to struts-config.xml, tiles-def.xml etc.Nothing 似乎有效。有人有什么想法吗?

0 投票
1 回答
220 浏览

servlets - 动作表单转发路径不是 url

当我在第一次转发(然后成功转发)中有如下示例的路径时,这意味着什么

我知道如果返回“失败”,失败转发将转发到页面“/Homepage.do”

但是如果我回来会发生什么

这将尝试加载什么包?web.xml我如何通过查看和struct-config.xml文件找出答案?

0 投票
2 回答
1345 浏览

java - Struts 1.x ActionForm 动作类

我有一个带有四个按钮的简单 html 页面。我知道如何映射按钮,以便动作类获取所选内容的值并根据动作类中的每个按钮调用方法。但是,我应该如何处理行动表格?我可以把它留空吗?似乎struts 需要您映射一个bean,但我不确定在Action Form 中放置什么,因为我要做的只是调用Action 类中的方法。

0 投票
1 回答
640 浏览

java - struts action form not displaying when coming from an external action

I have two applications (say ExternalAPP and InternalAPP) each has their own EAR in the same server, I'm using Struts 1.2. The idea is to call from InternalAPP one of ExternalAPP's jsp file and populate it with InternalAPP's information.

Since I cannot access ExternalAPP's ActionForm from InternalAPP, I create a similar form (InternalForm) and set it in the request attribute, then forward the action to ExternalAPP to setup it's action form called ExternalForm:

InternalAPP's code:

InternalAPP's struts-config.xml

ExternalAPP's code:

ParseFormAction.java

myDesiredPage.jsp

I can get to the myDesiredPage.jsp from the InternalAPP just fine but it won't populate the information I sent on the request, all values will be empty.

What am I missing? I'm setting all values in ExternalAction in the action class before calling the JSP, why is it not picking them up?

If there's a better way to do it by all means please let me know, it seems to me that there should be a better way to do it.

Thanks in advance.

0 投票
0 回答
333 浏览

java - 操作表单返回错误时如何调用jsp页面onload函数?

我有一个 JSP 页面,其中包含一些组件,例如“从日期、到日期和一些将预先填充的选择标准”和一个提取按钮。

如果我单击提取按钮,它应该经过一些验证并返回 actionErrors(如果找到)。

但是,问题出在验证之后,如果验证失败,则会显示适当的错误消息,但预填充的组件会变空。

如何调用jsp的onload函数预填充所有组件?

验证方法供参考:

}

jsp页面供参考

0 投票
0 回答
632 浏览

jsp - Struts 空 ActionForm

我是 Struts 新手,使用 Struts 1.2.7。我的目标是能够阅读帮助构建我的 JSP 的操作类中的表单。我可以使用我的 JSP/Struts 中的表单来创建一个数据表,并且我可以从表中清除数据,所有这些都通过 action 类执行方法。但是,我不能做的是读取/查看在我的操作类执行方法中创建 JSP 的相同表单。我得到的是一个空的 ActionForm 传递给我的动作类执行方法。我的第一个猜测是我有一个 JSP/HTML 问题。我认为这是一个非常基本的问题,欢迎任何帮助。