Can't get request attribute in struts action class

╄→尐↘猪︶ㄣ 提交于 2019-12-06 07:36:00

Request attributes live as long as the HTTP request in question lives. It starts whenever the client has actually sent it and it ends whenever the client has retrieved the complete HTTP response associated with the HTTP request. Any subsequent request is a brand new one which does not at all contain a copy of the attributes of the previous request.

You need to pass it as a request parameter instead. For example, as a hidden input field of a form of the other page.

<form ...>
    ...
    <input type="hidden" name="blah" value="${fn:escapeXml(param.blah)}" />
</form>

(the JSTL fn:escapeXml() is to prevent your site from XSS attacks while redisplaying user-controlled input)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!