问题标签 [interceptorstack]
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.
jsp - How to preserve NULL state in a Boolean sending an empty String from JSP to Action
I have a criterion in a search page that is a boolean
.
Since it is not mandatory, I can't use a checkbox, because I may want to skip it;
JSP
Action
We know that boolean
defaults to false
, while Boolean
defaults to null
, then the first time the page is rendered, it is ok ("Make your choice" is displayed).
After the POST, however, Struts instantiates the Boolean
property (defaulting it to false
) even when it finds ""
as value, so when I come back to the JSP, the value is preselected to false
("BAR").
How can I instruct Struts to not create an instance of that variable if the value is ""
, leaving it to its original, null
state ? Do I need to create a Converter, or to specify something in the .properties
file ? (I've basically the same code as in example .2 from this answer)
I'm using (a slightly custom) paramsPrepareParamsStack
Interceptor Stack.
I feel like if I'm missing something stupid.
java - 在 Struts 2 中使用拦截器时出现 NullPointerException
这是我的WelcomeAction
课:
这是我的struts.xml
文件:
我尝试使用拦截器,但是当我取消注释时它NullPointerException
被抛出。
我是 Struts 2 的新手,想了解一下。我正在讨论拦截器并从本教程中学习。
java - 如何在取消时绕过 Struts 验证
我在struts.xml
.
然后我有我提到的 JSP 页面
表单有 3 个提交按钮。
我的动作类有这些方法:
单击取消按钮也会触发验证。有没有办法阻止点击取消触发验证?
更改代码:
java - 仅 REST - default-interceptor-ref 不起作用
我使用它作为在 Struts2 上创建仅 REST 配置的参考:
https://cwiki.apache.org/confluence/display/WW/REST+Plugin
我目前的问题是拦截器。我创建了一个示例拦截器,应该在操作被触发之前执行。
这里是:
这是我的 struts.xml 文件:
日志(catalina.out)说我的拦截器已初始化,但实际上从未拦截任何东西。
显然,映射器类default-interceptor-ref
不能很好地工作。rest
是这样吗?还是我在这里做错了什么?
struts2 - 插入延迟后未使用 execAndWait Struts 拦截器下载文件
我的代码从后端服务器下载文件。由于我们将检索数以百万计的记录,因此我们使用了 Struts2execAndWait
拦截器。为了测试这一点,我们插入了 30 秒的延迟。我能够在不插入延迟的情况下下载文件(测试数据非常小),但插入后,我再也没有得到文件。日志显示,由于等待文件中的 5 秒,动作类被重复执行<meta-refresh>
,即使输入流被填充。
这种行为的原因可能是什么?
代码设置:
Struts.xml:
PS:我还没有在百万数据集上测试过这段代码。测试数据仅包含少量数据。
java - 拦截器没有在 Struts 中被调用
我的拦截器(验证)在操作之前或之后没有被调用。任何想法如何让它工作?
注意:每次调用默认拦截器时。
java - Properties not being set in prepare method
I am using Struts2 and an action implementing the Preparable
interface.
When I submit the form, action properties are not being set in prepare()
method of action. I get the values in the action method (eg. execute()
), but they are empty in the prepare()
method.
How can I get the properties set before running the prepare()
method ?
java - 禁用拦截器的执行
我正在研究 Struts 2。在实施拦截器期间,我遇到了一个问题:
是否可以通过配置或任何其他方式一起停止拦截器的执行?
java - 令牌/令牌会话拦截器导致 HttpSession 上的空指针
我正在研究 struts2 Web 应用程序,我正在使用令牌拦截器处理 CSRF 漏洞。
我正在做的是成功和错误,我会将用户重定向到同一页面,但有操作错误或成功消息。
没有令牌/令牌会话拦截器一切正常,但是当我使用拦截器时,我得到 NullPointerException。
堆栈跟踪
动作类
代码有什么问题?
不是在同一页面上重定向会导致问题(提交的令牌将与新生成的令牌不同)?
- 如果是,那么我应该如何处理这种情况而不重定向到其他页面?
java - Struts 2 中的拦截器无法正确重定向页面
就是这样,我编写了一个拦截器登录,结果是
一切正常,但我认为这是回忆它,结果去访问并再次执行拦截器并去访问等。我相信因为我的浏览器显示了消息:
页面未正确重定向。
我正在使用 Struts 2 和 Rest 插件。
这是我的拦截器: