JohnRambo
JohnRambo

Reputation: 518

How do i remove a row from the database from selected row in table? JSP

I am trying to make an editable table in jsp. I want to include also a delete button, on the other hand when i click the delete button i want to remove the row and also to remove the entry in the database.

I am using jsp and MySQL on Liferay portlets.

Can you please help me?

Thanks in advance!!

Upvotes: 1

Views: 1635

Answers (1)

javadev
javadev

Reputation: 1669

You can put a link called "Delet entry" in front of each row in your JSP. This link will execute a Servlet py getting aparameter from the JSP. Something whcih will look like this:

<a href="/DeleteServlet?id=<%=your_id_row%>"Delete entry</a>

Then in your Servlet's doGet method get the id param by String id = request.getParameter("id"); and then delete the row by an SQL query.

Upvotes: 2

Related Questions