"No getter method" error

2003-10-10 Thread Dennis Dunn
Hello,

I am working on my first Struts application and  I've run into a problem 
with reading bean properties with the taglibs. I am using the NetBeans 
IDE w/j2sdk 1.4.2 and Struts 1.1.

OK, this is what I see in my browser:

[ServletException in:/tiles/timesheet_viewer.jsp] No getter method for 
property date of bean day'

Here is a chunk of the log file for the Tomcat container:

javax.servlet.jsp.JspException: No getter method for property date of 
bean day
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:286)
at 
org.apache.jsp.timesheet_0005fviewer$jsp._jspService(timesheet_0005fviewer$jsp.java:128)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
..
..

I've checked the struts-user archives for "no getter method" and a lot 
of those threads were caused by problems with property names and their 
corresponding accessors.  I've double-checked my beans and that doesn't 
seem to be the problem. My getter/setters use the same datatype, I 
reference "date" in the tag and my getter is "getDate()", I haven't 
overridden my accessor methods or provided multiple accessors with 
different signatures

My next step will be to take a look at RequestUtils.java:968 to see if 
that provides me with a clue as to what I'm doing wrong.

Thanks for your help.

--dennis

Here is the chunk from the JSP that is using the logic and bean taglibs. 
"week1" is a WeekBean that holds 7 DayBeans.  Each DayBean then has some 
properties that I would like to display:






Note that this works fine, the toString() method of the DayBean is 
called and returns the classname:






Next we've got my beans, I've removed some comments and cruft to make 
this not manageble:

public class DatedTimesheetBean extends Vector {

/** A string to be used when this bean is displayed. */
private String date = "";
/** The total elapsed time (in seconds) of all of the items in this 
bean. */
private int elapsedSeconds = 0;

public DatedTimesheetBean() {
}
public DatedTimesheetBean(int size) {
setSize(size);
}
public String getDate() {
return date;
}
public void setDate(String d) {
date = d;
}
public int getElapsedSeconds() {
return elapsedSeconds;
}
public void setElapsedSeconds(int s) {
elapsedSeconds = s;
}
public void addElapsedSeconds(int s) {
elapsedSeconds += s;
}
/**
 * Take the elapsed time value (in seconds) and format it
 * for display as HH:MM.
 * @return A String in HH:MM format.
 */
public String getElapsedTime() {
	

return sb.toString();
}
}
public class WeekBean extends DatedTimesheetBean {

private static final int SLOTS = 7;

/** Creates a new instance of WeekBean */
public WeekBean() {
super(SLOTS);
for (int i = 0; i < SLOTS; i++) {
set(i, new java.util.Vector());
}
}
public void addDay(DayBean day) {
set(day.getDow(), day);
}
}
public class DayBean extends DatedTimesheetBean {

private static final int SLOTS = 8;

/** The day of the week represented by this DayBean. 0=Sunday, 
6=Saturday */
private int dow = 0;

/** Keeps track of the number of slots we have available for events. */
private int slotCounter = 0;
/** Creates a new instance of DayBean */
public DayBean() {
super(SLOTS);
for (int i = 0; i < SLOTS; i++) {
set(i, "00:00");
}
}
/** Set the day-of-week value for this bean. */
public void setDow(int i) {
dow = i;
}
public int getDow() {
return dow;
}
public String toString() {
return this.getClass().toString();
}
}


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: "No getter method" error [SOLVED]

2003-10-13 Thread Dennis Dunn
Hello,

The tile was choking because I was trying to call a getDate() method of 
a Vector object.  The WeekBean is initialized with Vector()s since I was 
going to iterate throught the contained objects as well as the WeekBean. 
 The first object in the WeekBean was a DayBean but the rest were 
Vectors. When I iterated the WeekBean I was doing OK so lonad a I was 
looking at a DayBean but it choked when I was looking at a Vector.

Challange your assumptions. They are probably wrong.

--dennis



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]