Hi Laurie!
Thanks for the prompt response. I am pasting code snippets at every level
(ActionForm, Action class and view). This did not work. Please let me know if I
am missing something here.
Thanks again!
//*************ActionForm class********************
//core java classes
import java.util.ArrayList;
import java.util.Collection;
// Java extension classes
import javax.servlet.http.HttpServletRequest;
// third-party classes
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
// local project classes
import com.foo.foo1.web.Constants;
import com.foo.foo1.soapcalls.FileObj;
public final class FileReceiptFormBean extends ActionForm
{
// File specific property variables
private String fileName;
private String fileType;
private String fileSize;
private String fileModifiedDate;
private String multipleFiles;
private String fileURL;
private ArrayList alObjFile;
private FileObj objFile;
public String getFileName()
{
return (this.fileName);
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
public String getfileType()
{
return (this.fileType);
}
public void setfileType(String fileType)
{
this.fileType = fileType;
}
public String getfileSize()
{
return (this.fileSize);
}
public void setfileSize(String fileSize)
{
this.fileSize = fileSize;
}
public String getfileModifiedDate()
{
return (this.fileModifiedDate);
}
public void setfileModifiedDate(String fileModifiedDate)
{
this.fileModifiedDate = fileModifiedDate;
}
public String getmultipleFiles()
{
return (this.multipleFiles);
}
public void setmultipleFiles(String multipleFiles)
{
this.multipleFiles = multipleFiles;
}
public String getfileURL()
{
return (this.fileURL);
}
public void setfileURL(String fileURL)
{
this.fileURL = fileURL;
}
public ArrayList getAlObjFile()
{
return (this.alObjFile);
}
public void setAlObjFile(ArrayList alObjFile)
{
this.alObjFile = alObjFile;
}
public FileObj getObjFile()
{
return (this.objFile);
}
public void setObjFile(FileObj FileObj)
{
this.objFile = objFile;
}
}
//*************End ActionForm class********************
//*************Action class********************
ArrayList alAFFFile = new ArrayList();
FileObj[] objFiles = null;
objFiles = intf.getFiles(ctx, filename);
String affUrl = "";
for ( int i=0; i < objAFFFiles.length; i++)
{
affUrl = objFiles[i].fileURL;
FileReceiptFormBean frfBean = new FileReceiptFormBean();
frfBean.setFileName(objFiles[i].fileName);
frfBean.setfileType(objFiles[i].fileType);
frfBean.setfileSize(objFiles[i].fileSize);
frfBean.setfileModifiedDate(objFiles[i].fileModifiedDate);
frfBean.setmultipleFiles(objFiles[i].multipleFiles);
objFiles[i].fileURL = LoadFileUrlCreator.create(affUrl, "application/zip",
true);
frfBean.setfileURL(objAFFFiles[i].fileURL);
alFile.add(objAFFFiles[i]);
}
session.setAttribute("AFFFiles", alAFFFile);
//*************End Action class********************
//*************view.jsp********************
<logic:iterate id="afffiles" name="AFFFiles" >
<bean:write name="afffiles" property="fileName"/>
</logic:iterate>
----- Original Message ----
From: Laurie Harper <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, March 8, 2007 5:11:20 PM
Subject: Re: logic:iterate tag!
Swaminathan Subramanian wrote:
> All,
> I am working on application using Struts 1.0. I am trying to display
> an ArrayList of complex objects using the logic:iterate tag.
> Here's some more details -
>
> FileObj
> fileName
> fileSize
> fileType
> fileModifiedDate
>
> Action class
> FileObj[] objFiles = null;
> objFiles = intf.getFiles(ctx, filename);
>
> I tried several approaches as mentioned in different posts but I am
> not able to display this ArrayList of FileObjects. If somebody could outline
> a list of steps to be followed to do this, I would apprecuate it.
> Thanks in advance!
> -SS
Well, you'll need to expose the objFiles property to the JSP somehow (by
putting it in request/session scope, or in your form bean, for example).
Asuming you've done that, and that you have appropriate getters on your
FileObj, you can access it like this:
<logic:iterate id="file" name="yourFileObjRef">
<bean:write name="file" property="fileName"/>
</logic:iterate>
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]