I am using structs to try and get the "update" functionality working.

I have a list of items appearing in the jsp page, "viewItem.jsp" . I am getting this list from the database. At the
moment I am just displaying the item description, but item id is also available in the list.

Code for viewItem.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form"%>


<html>
<head>
<title>List</title>
</head>
<body>

<table cellspacing="3" cellpadding="3" border="3" width="500">

	<tr>
		<td><b>Frequencies</b></td>
		<td><a href="enterFrequency.jsp">Add Frequency</a><br>
		</td>
	</tr>

	<c:forEach items="${requestScope.resultsList}" var="frequencyList">
		<tr>
			<td><c:out value="${frequencyList.description}" /></td>
		</tr>
	</c:forEach>

	<a href="enterItem.jsp"> <c:out
		value="${frequencyList.description}" /> </a>

</table>
</body>
</html>

Every item is clickable i.e. url, which will direct to another jsp page, "enterItem.jsp", which has
the input filed names as "description".

Code for enterItem.jsp

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form" %>

<html>
<head>
<title>Entering New Item</title>

</head>

<body>
<form:form action="/enterFrequency">
	<table>
		<tr>
			<td colspan="2"><h3>Frequency Entering<h3>
			</td>
		</tr>
		<tr>
			<td>Description:</td>
			<td><form:text property="description"/></td>
		</tr>
	</table>
	
<form:submit value ="Save"/>
</form:form>
</body>
</html>

What I am looking for is, that input field "description" in enterItem.jsp gets
populated with the item that was clicked on the "viewItem.jsp" page, so that the description
could be changed, and can be updated for that particular id.

I want to know how can I get this functionality work.

Suggestion or urls are greatly appreciated.

This article has been dead for over six months. Start a new discussion instead.