Hello
Can anyone please help me in getting a button 'update' in a table to populate fields in input text fields in a form.
This may sound silly but a huddle for me as a new graduate so far.. thanks!!!
*I want to edit items on the table a table
*I have decided to grab the items to be edited by and update button
*This 'update' button should then populate my form, which I originally use to add the items to the table
Bellow is my sample jps page with all form controls
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>List Contacts</title>
<link rel="stylesheet" type="text/css" href="css/springTest.css" />
<!--samplCode-->
<!--sampleEndCode-->
</head>
<body>
<h1>List Contacts</h1>
<!--reload button outside form to enable reload with out postback of data-->
<h2>
<button><a style="color: red;" href="index.jsp">Home</a></button>
</h2>
<!--form controls for inputs-->
<form action=" " method="post">
<h5 style="color: red">Please enter new contact details below</h5>
<h5>Contact Name: <input type="text" name="_name"><br>
</h5>
<h5>Contact Number: <input type="text" name="_number" size="20"></h5>
<input type="submit" value="submit" onclick=index.jsp;;>
<input type="reset" value="Reset">
</form>
<!--table construction for display List-->
<form action="">
<table class="list">
<tr>
<th style="width: 200px;">Name</th>
<th style="width: 150px;">Number</th>
<th>Edit</th>
</tr>
<c:forEach var="contact" items="${contactList}">
<tr>
<td>${contact.name}</td>
<td>${contact.number}</td>
<td>
<button>Update</button>
</td>
</tr>
</c:forEach>
</table>
</form>
</body>
</html>
!--removed tag-->
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).