如何在Struts2中将JSP目标设置为父框架?
在我的 Web 应用程序中,有一个页面(.jsp
)分为三个框架。 AddCp.jsp
位于该 JSP 的一个框架中。现在,在会话超时时,我想再次显示登录页面。但问题是登录页面仅出现在该框架中而不是整个窗口中。
下面是来自 struts.xml
的代码片段:
<action name="AddCP" class="com.appupdate.action.AppUpdateAction" method="addCP">
<result name="success">/WEB-INF/pages/AddCP.jsp</result>
<result name="login" type="redirectAction">
<param name="actionName">showLogin</param>
<param name="namespace">/login</param>
<param name="navigation">timeout</param>
<param name="target">_parent</param>
</result>
</action>
有人可以帮忙吗?我如何在这里更改目标框架?
In my web application, there is one page(.jsp
) which is divided into three frames. AddCp.jsp
is in one frame of that JSP. Now on session timeout I want to show login page again. But the problem is this that the login page is coming in that frame only not on the whole window.
Below is the code snippet from struts.xml
:
<action name="AddCP" class="com.appupdate.action.AppUpdateAction" method="addCP">
<result name="success">/WEB-INF/pages/AddCP.jsp</result>
<result name="login" type="redirectAction">
<param name="actionName">showLogin</param>
<param name="namespace">/login</param>
<param name="navigation">timeout</param>
<param name="target">_parent</param>
</result>
</action>
Could anyone please help? How can I change the target frame here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请求应指定目标,响应没有任何方法可以更改它。您将从发起请求的位置将其加载到框架中。
[已编辑]
要确认这一点,您可以参考此JavaRanch 线程。
解决方案:
您可以在
login.jsp
中添加 JavaScript 语句。The request should specify the target, response doesn't have any way to change it. You are getting that loaded in the frame from where request was initiated.
[Edited]
To confirm this, you can refer to this JavaRanch thread.
Solution:
You can have a JavaScript statement in your
login.jsp
.