Hi None None... So in your JSP you are iterating over an ArrayList of File objects, trying to get at a property inside the File objects. To get at nested objects, you use the Struts nested tag library.
Try replacing your <logic:iterate....> with the equivalent from the nested library: (below off the top of my head) <nested:iterate id="drive" name="listDrivesForm" property="drives" type="java.io.File"> <nested:write name="drive" property="name"/> </nested:iterate> See if you have luck with that. -----Original Message----- From: None None [mailto:[EMAIL PROTECTED] Sent: Thursday, May 06, 2004 2:16 PM To: [EMAIL PROTECTED] Subject: Some further newbie woes Ok, I've banged my head enough in the past two hours... I'm working on a file manager Struts app to get myself acquainted with Struts. The first logical step is a list of drives. Here's what I've done... I have created an index.jsp that does a quick forward to main.jsp (just like the blank struts app does). In main.jsp I have a simple link to listDrives.ofm (using extension mapping in this app). Here's my struts-config.xml file, minus comments, linebreaks and the XML & doctype tags (to save space here)... <struts-config> <form-beans> <form-bean name="listDrivesForm" type="com.omnytex.ofm.actionforms.ListDrivesForm" /> </form-beans> <global-forwards> <forward name="main" path="/main.ofm" /> </global-forwards> <action-mappings> <action path="/main" type="org.apache.struts.actions.ForwardAction" parameter="/jsp/main.jsp" /> <action path="/listDrives" type="com.omnytex.ofm.actions.ListDrivesAction" name="listDrivesForm" scope="request" validate="false"> <forward name="showDrivesList" path="/jsp/drivesList.jsp" /> </action> </action-mappings> </struts-config> Simple enough. So, I click my link and the following ActionForm is instantiated in request scope: package com.test.ofm.actionforms; import org.apache.struts.action.*; import java.io.*; import java.util.*; public class ListDrivesForm extends ActionForm { private ArrayList drives = null; public ListDrivesForm() { drives = null; } public void setDrives(File[] inDrives) { drives = new ArrayList(); for (int i = 0; i < inDrives.length; i++) { drives.add(inDrives[i]); } } public ArrayList getDrives() { return drives; } } Also simple enough. Next, the following action executes: package com.test.ofm.actions; import org.apache.struts.action.*; import java.io.*; import javax.servlet.http.*; import com.test.ofm.actionforms.*; public class ListDrivesAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { File[] drives = File.listRoots(); ListDrivesForm ldf = (ListDrivesForm)form; ldf.setDrives(drives); return mapping.findForward("showDrivesList"); } } Now, to this point I am OK because if I do a simple println of ldf.getDrives(), I in fact get a list of the drives on my system as expected. So, I know my basic flow to this point is OK, and I know the code in the action is doing what I expect. Lastly, I have the following JSP: <%@ page language="java" import="java.io.*,com.omnytex.ofm.actionforms.*" %> <%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%> <html> <head> <title>File Manager</title> </head> <body> File Manager <br><hr><br> <table border="1" cellpadding="0" cellspacing="0" width="100%"> <logic:iterate id="drive" name="listDrivesForm" property="drives"> <tr><td><bean:write name="drive" property="name" /></td></tr> </logic:iterate> </table> </body> </html> This is where the problem arises... My table is being built, and the proper number of rows are there, but I'm not seeing the drive letter being displayed. I have verified that my listDrivesForm is present and populated by donig: <% ListDrivesForm ldf = (ListDrivesForm)request.getAttribute("listDrivesForm"); System.out.println(ldf); %> Sure enough, I see my drive list. Now, I've been playing with various names and ID combinations in the logic:iterate and bean:write tags, but nothing seems to make it work. I've also tried in place of bean:write: <tr><td><%=((File)drive).getName()%></td></tr> >From my reading I expected that to work just as well. I've also tried adding the scope attribute to the bean:write tag to no avail. So, what am I doing wrong here? Do I need to do usebean here? Every example I've seen of this never shows that, so I assume not. Also, why didn't the code manually calling getName() above not work either? Even if I needed useBean I would expect that to still work, which leads me to believe I DON'T need useBean. Any help is very much appreciated! _________________________________________________________________ MSN Toolbar provides one-click access to Hotmail from any Web page - FREE download! http://toolbar.msn.com/go/onm00200413ave/direct/01/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]