Issue
Suppose, I have updated my database by which I mean that I have inserted a new row of data in my database. Now, I want to edit my web page by that data how can I do this?
Suppose, I have three columns in my database "name", "picture" and "age" now I want to show the latest row of these columns in my HTML page with CSS applied. How can I do this please tell me the codes in terms of JSP and servlet.
Solution
First get that value in your servlets from database and then to show it in webpage
You can do two things :
Use
request.setAttribute("id",value)
In the GET method of servlet,request.setAttribute("name",value) request.setAttribute("picture",value) request.setAttribute("age",value)
And in the jsp, you can get these values asrequest.getAttribute("name") request.getAttribute("picture") request.getAttribute("age")
Model
model.addAttriute("name",value)
Use JSTL library and then you get these values in jsp by:
${name}
${picture}
${age}
Answered By - Amit Kumar
Answer Checked By - Clifford M. (JavaFixing Volunteer)