I'm New to SpringBoot,
I found 3 methods to send parameter from backend to frontend.
java code: https://paste.ubuntu.com/p/dtbBJVX3jQ/
HttpSession.setAttribute()
HttpServletRequest.getServletContext().setAttribute()
WebRequest.setAttribute()
Could you tell me what's the difference between 3 setAttribute()
when in usage?
Thanks for your help
SCOPE_REQUEST
, SCOPE_SESSION
). A session-scoped attribute is the same as for HttpSession
. A request-scoped attribute only lives for the duration of the request.ServletContext
is created only once per web application, so you could only use it to save some global attributes that don't change for different requests.