Dear Experts,
What is the best practice of sending and receiving the parameters from JSp to Servlet and vice versa
ORCode :request.getParameter
Code :session.setAttributes
Any Suggestion will be appreciated
Printable View
Dear Experts,
What is the best practice of sending and receiving the parameters from JSp to Servlet and vice versa
ORCode :request.getParameter
Code :session.setAttributes
Any Suggestion will be appreciated
Hello,
I suggest you use the following.
request.getParameter(String)
Use this to get a request parameter value.
request.setAttribute(String, Object)
Use this method to add an attribute to the request before you forward it to the JSP, this way the JSP will be able to grab the attribute and use it when rendering the page.
session.setAttribute(String, Object)
Use this method when you want something stored for the lifetime of the session and over multiple requests. This can be useful for storing a User object for instance once a user has logged in.
// Json
Many Thanks Json