wood burning stoves 2.0*
The moose likes Struts and the fly likes Read table values in Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Read table values in Action" Watch "Read table values in Action" New topic
Author

Read table values in Action

Kieran O'Callaghan
Greenhorn

Joined: Aug 09, 2011
Posts: 2
My application stores information on courses, companies, students and results. Students can be associated to one or more companies.
On the update student page the user has the option to associate or disconsolate companies with a student.

So far I have the full list of companies listed on the update student page along with the correct the Boolean values (associated or not associated).
Also the user and associate or disassociate companies by checking or unchecking a tick box for each of the companies.
The problem I am having is in the Update Student Action, I am not able to read the company details and the boolean values from the table on the update student page.

I do not know how to save this student - company relationship in the Student Form, I have tried saving the values in the session and reading them from there but updates I make on the update student page are not picked up. Also I cannot figure out how to read directly the values on the update student jsp to the update student action.

HELP!!! I am out of ideas!
I hope my explanation is clear.
Here is a code snippet from the update student JSP. I am able to populate the table below from the DB using values I have read in the Get Student Action.

<table border ="1">
<tr><td><b>Company Name</b></td>
<td><b>Company Type</b></td>
<td><b>True or False</b></td>
<td><b>Selected</b></td>
</tr>

<c:forEach var="c" items="${companyList}">
<tr>
<td><cut value="${c.companyName}"/></td>
<td><cut value="${c.companyType}"/></td>
<td><cut value="${c.associatedWithStudent}"/></td>
<td>
<c:if test="${c.associatedWithStudent==true}">
<input checked="checked" type="checkbox" name="${c.companyName}" value="${c.companyId}" />
</c:if>
<c:if test="${c.associatedWithStudent==false}">
<input type="checkbox" name="${c.companyName}" value="${c.companyId}"/>
</c:if>
</td>
</tr>

</c:forEach>
</table>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read table values in Action
 
Similar Threads
I cant set any values in my Action Form for Contact object:
Passing check box value to servlet.
Display data from database to jsp page.
How to use Break / exist statement here in foreach (JSTL)
check boxes retrieving problem