I found this post that shows how to pass multiple check box selections to another JSP page, but it's not working for me. When I try to get the selected values I get:
checked boxes: [Ljava.lang.String;@3f3fbd
Here are my two pages (be gentle, this is my first attempt at JSP!)
createSHAREfile.jsp basically runs a query to find all the terms that have not been processed and show each term with a check box next to it:
<title>Create SHARE Files</title>
</head>
<body>
<jsp:include page="../menu/header.jsp" flush="false" />
<form name='SelectSHARETerms' method='post' action="SHAREProcessing.jsp">
<fieldset><legend>Select Terms to Process for SHARE</legend>
<table align='left'>
<%
String termDetail = "", currDate = "";
currentDateTime datetime = new currentDateTime();
datetime.setCurrDate();
currDate = datetime.getCurrDate();
java.sql.Date todayDate = java.sql.Date.valueOf(currDate);
Terms terms = new Terms();
ArrayList<Terms.termsTable> termsObjList = new ArrayList<Terms.termsTable>();
terms.setTermsSql("Select * from Terms where TermDate <= '" + currDate + "' AND VoucherProcessDate Is Null");
boolean indicator = terms.setListOfTerms();
if (indicator == true)
{
int size = terms.getListSize();
termsObjList = terms.getTermsList();
for (int i=0; i<size; ++i)
{
Terms.termsTable eachTerm = (Terms.termsTable)termsObjList.get(i);
java.sql.Date termDate = eachTerm.TermDate;
%>
<tr><td><input TYPE=checkbox name=SelectedTermDate id='SelectedTermDate<%= i %>' VALUE="<%= i %>"><%=termDate %></td></tr>
<%
}
}
%>
<tr><td align='center'><input type='submit' value='Submit'></input></td></tr>
</table>
</fieldset>
</form>
</body>
</html>
When the submit button is pressed I call SHAREProcessing.jsp. Right now all i'm trying to do on this page is show which termdates the user has selected so I can use them as parameters to a Java Class that will create the files for the selected terms:
<title>SHARE Processing</title>
</head>
<body>
<jsp:include page="../menu/header.jsp" flush="false" />
<table width='50%' align='center' border='1'>
<% String[] SelectedValues = request.getParameterValues("SelectedTermDate");
System.out.println("checked boxes: " + SelectedValues);
%>
</body>
</html>
Here's where I'm trying to use the code shown in the other post but it's not working :(
Thanks for any help! Leslie