Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing String array

Status
Not open for further replies.

112055

Programmer
May 13, 2002
61
US
Hello,
I have a bunch of documents saved in a batch, laterwards I press print batch, then it supposedly print each of the documents as saved in the batch, but as of right now, only the first document print, the rest of it doesn't, can anyone tell me if I miss something in my code? many many thanks.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
String[] myFiles = new String[0];
%>
<SCRIPT Language=&quot;Javascript&quot;>
var printFileName = new Array(
<%
if(mySession.getAttribute(&quot;printFileNames&quot;) != null)
{
myFiles = (String[]) mySession.getAttribute(&quot;printFileNames&quot;);
for(int i=0; i< myFiles.length; i++)
{
if(i>0) out.print(&quot;,&quot;);
%>
&quot;<%=myFiles%>&quot;
<%
}
}
%>);
</SCRIPT>
<%
 
Couple of things ...

>>> String[] myFiles = new String[0];

This is settings myFiles to have no elements ... try
String[] myFiles;

and

>>> &quot;<%=myFiles%>&quot;

prints out the String[] object, not the elements, you want to loop the elements of the array ...

for(int i, ....) {
<%=myFiles%>
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top