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.

You can do so by passing the bean in session/request scope when you are clicking the link.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.