Ali,

Try <logic:iterate name="reportForm" property="units"
 id="unit">
   <bean:write name="unit" property="owner"/>

You will also need to populate the form before you use
it. If you enter /jsp/report.jsp as the url the null
error occurs because the reportForm has not been
created yet (although once it has been created it
should work fine because reportForm is sitting in the
session).

If you enter /report.do as the url struts knows that
this is an action, it creates a reportForm for you and
passes it into the perform method of ReportAction.

The perform method then populates the reportForm as
necessary and returns an ActionForward object normally
done by:
return (mapping.findForward("success"));

Now your newly populated form is sitting in the
session ready for your page to use.

Also if you want report.jsp to use reportForm you
should forward to report.jsp. 

Try looking at struts-config_1_0.dtd in your struts
distribution it gives full details of what the
different parts of struts-config.xml does.

Adam.

--- Ali Ozoren <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I have a Report bean, a ReportForm and a report.jsp.
> ReportForm has a property called report of type
> Report. Hence it is using
> the underlying report as storage.
> In report.jsp, I refer to forms's properties as
> report.aProperty,
> report.anotherProperty.
> Report has a units property of type Hashtable. This
> hashtable contains
> values of type Unit.
> 
> Config-struts looks like this:
> 
>     <action    path="/report"
>                type="myApp.ReportAction"
>                name="reportForm"
>               scope="session"
>               input="/jsp/report.jsp">
>       <forward name="unit"  path="/jsp/unit.jsp"/>
>     </action>
> 
> Yet,
> 
> When I try to iterate using
> 
> <logic:iterate name="report" property="units"
> id="unit">
>   <bean:write name="unit" property="owner"/>                  //
> owner is a property of
> unit
> </logic:iterate>
> 
> I get
> 
> javax.servlet.ServletException: Cannot find bean
> unit in scope null
> 
> I tried other variations of the iterate.
> 
> Now, when I look at the example that comes with
> Struts, I see the user
> variable of type User being added to the session in
> the login action, before
> it gets used in the registration.jsp. If I
> understand Struts, in my case,
> reportForm that is defined in struts-config,
> scope=session, should be same
> as adding reportForm programmatically. But
> apparently it isn't. Or is it? :)
> Any idea?
> 
> Thanks,
> --a
> 


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. 
http://im.yahoo.com

Reply via email to