0

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.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Prakhar
  • 25
  • 4

1 Answers1

0

First get that value in your servlets from database and then to show it in webpage

You can do two things :

  1. 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 as

    request.getAttribute("name") request.getAttribute("picture") request.getAttribute("age")

  2. Model

    model.addAttriute("name",value)

Use JSTL library and then you get these values in jsp by:

${name} ${picture} ${age}

Amit Kumar
  • 377
  • 4
  • 17