更新时间:2023-01-16 17:05:36
没有。不幸的是,Request对象只有在页面加载完成后才可用 - 一旦完成,你将丢失其中的所有值,除非它们已被存储在某处。
No. Unfortunately the Request object is only available until the page finishes loading - once it's complete, you'll lose all values in it unless they've been stored somewhere.
如果你想要通过以下任何一个请求保留属性:
If you want to persist attributes through requests you need to either:
< ; input type =hiddenname =myhiddenvaluevalue =<%= request.getParameter(value)%> />
。然后,它将作为请求参数在servlet中可用。 request.getSession()
- 在JSP中,这只是 session
)<input type="hidden" name="myhiddenvalue" value="<%= request.getParameter("value") %>" />
. This will then be available in the servlet as a request parameter.request.getSession()
- in a JSP this is available as simply session
)我建议使用会话因为它更容易管理。
I recommend using the Session as it's easier to manage.