I have a jsp page and am trying to add text created by a form bean. I am
using <bean:define id="reports" name="reportsForm"
type="java.util.Collection"/> to define the bean and <bean:write
name="reports" property="report[7].reportID"/> to write the desired
information.
I am getting the error "Cannot find bean reportsForm in scope null"
Am I referencing my bean incorrectly?
I have appended the form bean that I am using.
Thanks
Courtney
package com.trimet.gis.buds.forms;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import java.util.*;
import com.trimet.gis.buds.states.Report;
import java.lang.reflect.Array;
import java.util.Vector;
/**
* Form bean for the Reports page. This form has the following fields,
* with default values in square brackets:
*
* @author Courtney Villegas
* @version $Revision: 1.0 $ $Date: 2002/04/24 4:34:00 $
*/
public class ReportsForm extends ActionForm {
// --------------------------------------------------- Instance
Variables
/**
* The maintenance action we are performing (Create or Edit).
*/
private String action = "Load";
/**
* Should we auto-connect at startup time?
*/
private boolean autoConnect = false;
// Reports collection
private Collection reports = null;
//Group report ID
private Integer groupReportId = null;
// Selected ReportId
private Integer reportId = null;
// -----------------------------------------------------------
Properties
public String getAction() {
return (this.action);
}
public void setAction(String action) {
this.action = action;
}
public boolean getAutoConnect() {
return (this.autoConnect);
}
public void setAutoConnect(boolean autoConnect) {
this.autoConnect = autoConnect;
}
public void setReports(Integer groupReportId) {
this.groupReportId=groupReportId;
}
public Integer getGroupReportId() {
return (this.groupReportId);
}
public void setReportId(Integer reportId) {
this.reportId = reportId;
}
public Collection getReports() {
reports = (Collection) new ArrayList();
//Hardcoded data for now... should be populated from db
Report[] report= new Report[9];
report[0] = new Report(1);
report[0].setReportName("on-time performance by individual trip");
reports.add(report[0]);
report[1] = new Report(2);
report[1].setReportName("on-time performance by route (all trips)");
reports.add(report[1]);
report[2] = new Report(3);
report[2].setReportName("ridership by individual trip ");
reports.add(report[2]);
report[3] = new Report(4);
report[3].setReportName("ridership by route (all trips)");
reports.add(report[3]);
report[4] = new Report(5);
report[4].setReportName("passenger census");
reports.add(report[4]);
report[5] = new Report(6);
report[5].setReportName("service events by train, by route and/or by
supervisory district");
reports.add(report[5]);
report[6] = new Report(7);
report[6].setReportName("run times by time point segment and date");
reports.add(report[6]);
report[7] = new Report(8);
report[7].setReportName("passenger census");
reports.add(report[7]);
report[8] = new Report(9);
report[8].setReportName("service events");
reports.add(report[8]);
return reports;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>