When coding the jsp server side, I usually use the getParameter method to call the print message of request. I wonder the difference between getParameter and getAttribute. Thank you.
jsp
getParameter
is used to extract the values contained in the client request.
http://getParameter.com/hellp?name=1
getAttribute
is the value set on the server that can be used within the same request.
It is used to refine and deliver values to be delivered to the view, such as the controller servlet.
// in servlet
request.setAttribute("user_vector", Arrays.asList(3, 4, 2, 1));
// // in jsp
Object vector = request.getAttribute("user_vector");
© 2024 OneMinuteCode. All rights reserved.