vandy02
asked on
JSP - Loop through HTML table for changes - update javabean
I have asked for assistance on a similar question where I did get some help and was able to display a table. However, I do not know how to loop through the html table and then send the changes to get updated.
This is my previous question: JSP - Edit table containing Beans / XML
This is where I got started: http://java.sun.com/developer/technicalArticles/xml/WebAppDev2/
I was told to loop through the table and find those that are checked. Then send the information to my JavaBean
<TABLE >
<TR>
<TH><input type="checkbox" name="masterChk"/></TH>
<TH>Symbol</TH>
<TH>Name</TH>
<TH>Price</TH>
</TR>
<%
java.util.Iterator folio = portfolio.getPortfolio();
Stock stock = null;
int recordCnt = 0;
while (folio.hasNext())
{
recordCnt++;
stock = (Stock)folio.next();
String stockSymbol = stock.getSymbol();
String stockName = stock.getName();
Float stockPrice = stock.getPrice();
%>
<TR>
<TD><input type="checkbox" name="chk<%=recordCnt%>" value="<%=stockSymbol%>"/> </TD>
<TD><%=stockName%></TD>
<TD><%=stockSymbol%></TD>
<TD><input type=text name="stockPrice<%=recordC nt%>" value="<%=stockPrice%>"></ TD>
</TR>
<%
}
%>
</TABLE>
This is my previous question: JSP - Edit table containing Beans / XML
This is where I got started: http://java.sun.com/developer/technicalArticles/xml/WebAppDev2/
I was told to loop through the table and find those that are checked. Then send the information to my JavaBean
<TABLE >
<TR>
<TH><input type="checkbox" name="masterChk"/></TH>
<TH>Symbol</TH>
<TH>Name</TH>
<TH>Price</TH>
</TR>
<%
java.util.Iterator folio = portfolio.getPortfolio();
Stock stock = null;
int recordCnt = 0;
while (folio.hasNext())
{
recordCnt++;
stock = (Stock)folio.next();
String stockSymbol = stock.getSymbol();
String stockName = stock.getName();
Float stockPrice = stock.getPrice();
%>
<TR>
<TD><input type="checkbox" name="chk<%=recordCnt%>" value="<%=stockSymbol%>"/>
<TD><%=stockName%></TD>
<TD><%=stockSymbol%></TD>
<TD><input type=text name="stockPrice<%=recordC
</TR>
<%
}
%>
</TABLE>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.