944,214 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 864
  • JSP RSS
Nov 27th, 2007
0

Updating functionality

Expand Post »
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

JSP Syntax (Toggle Plain Text)
  1. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
  2. <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form"%>
  3.  
  4.  
  5. <html>
  6. <head>
  7. <title>List</title>
  8. </head>
  9. <body>
  10.  
  11. <table cellspacing="3" cellpadding="3" border="3" width="500">
  12.  
  13. <tr>
  14. <td><b>Frequencies</b></td>
  15. <td><a href="enterFrequency.jsp">Add Frequency</a><br>
  16. </td>
  17. </tr>
  18.  
  19. <c:forEach items="${requestScope.resultsList}" var="frequencyList">
  20. <tr>
  21. <td><c:out value="${frequencyList.description}" /></td>
  22. </tr>
  23. </c:forEach>
  24.  
  25. <a href="enterItem.jsp"> <c:out
  26. value="${frequencyList.description}" /> </a>
  27.  
  28. </table>
  29. </body>
  30. </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

JSP Syntax (Toggle Plain Text)
  1. <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form" %>
  2.  
  3. <html>
  4. <head>
  5. <title>Entering New Item</title>
  6.  
  7. </head>
  8.  
  9. <body>
  10. <form:form action="/enterFrequency">
  11. <table>
  12. <tr>
  13. <td colspan="2"><h3>Frequency Entering<h3>
  14. </td>
  15. </tr>
  16. <tr>
  17. <td>Description:</td>
  18. <td><form:text property="description"/></td>
  19. </tr>
  20. </table>
  21.  
  22. <form:submit value ="Save"/>
  23. </form:form>
  24. </body>
  25. </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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
harbir is offline Offline
3 posts
since Jan 2007
Nov 28th, 2007
0

Re: Updating functionality

You can do so by passing the bean in session/request scope when you are clicking the link.
Reputation Points: 16
Solved Threads: 11
Junior Poster in Training
lookof2day is offline Offline
83 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: connection with crystal report
Next Thread in JSP Forum Timeline: href is not working properly in jsp





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC