Reputation: 1138
I have a jsp page which display some records in a table and each record has a link called update next to it. When update is clicked , the jsp page will call a servlet which gets some information from the url , such as the record ownername , record title , etc. (When the link is clicked , these information are attached to url).
The servlet which is called by the jsp page , will then dispatch its request and response to another jsp page , it will display "OK". (This is just a simple program which i have setup)
My problem is, the sevlet cannot dispatch to the other jsp page.
Here is what i have done :
This is the First Jsp page which will display the records (Works perfectly)
<body>
<table border="10">
<th>Project Owner</th><th>Project Supervisor </th>
<th>Project Title</th>
<th>Project Description</th>
<th>Start-Date</th>
<th>End-Date</th>
<th>Approval Status</th>
<c:forEach items="${nominationList}" var="Iter">
<tr>
<td>${Iter.projectOwner}</td>
<td>${Iter.projectSupervisor}</td>
<td>${Iter.projectTitle}</td>
<td>${Iter.projectDescription}</td>
<td>${Iter.startDate}</td>
<td>${Iter.endDate}</td>
<td>${Iter.acceptStatus}</td>
<td><a href="${pageContext.request.contextPath}/ProjectApproval/${Iter.projectOwner}">Update</a></td>
</tr> //Above is the link to update each record
</c:forEach>
</table>
</body>
This is the servlet code which it will call
RequestDispatcher updateDispatcher=request.getRequestDispatcher("testing.jsp");
updateDispatcher.forward(request, response);
//this servlet dispatches to the other jsp page
I found that if i remove the extra things in the url to update (In first jsp page code) , it works but the problem is i need those extra things to implement something else in the future.
Thank you for your time.
Upvotes: 0
Views: 1175
Reputation: 8217
If to my understanding , when you are trying to pass the ${Iter.projectOwner}
Because you are iterating it from a list. So the data must be available in the list.
You can try an hidden field instead like this ,
<input type="hidden" name="" value="${Iter.projectOwner}"
And use it in the form you are posting. .Hope it helps !
Upvotes: 1