Updating functionality

Reply

Join Date: Jan 2007
Posts: 2
Reputation: harbir is an unknown quantity at this point 
Solved Threads: 0
harbir harbir is offline Offline
Newbie Poster

Updating functionality

 
0
  #1
Nov 27th, 2007
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

  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

  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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 80
Reputation: lookof2day is an unknown quantity at this point 
Solved Threads: 10
lookof2day lookof2day is offline Offline
Junior Poster in Training

Re: Updating functionality

 
0
  #2
Nov 28th, 2007
You can do so by passing the bean in session/request scope when you are clicking the link.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JSP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC