D
Damon Getsman
True to bad style, I'm writing a piece of JSP right now where there's
a bit of actual code scriptlet embedded with <% ... %> tags now.
In the jsp above that scriptlet I'm working with 2 objects of
java.util.Date, called inDate and outDate. When I'm trying to access
the different objects er values or whatever within them, I'm using
standard inDate.minutes and etc. to attempt to do tests on them. Is
there something special that I need to know about accessing this kind
of object from within an embedded scriptlet? I'm getting a server log
error of
An error occurred at line: 169 in the jsp file: /reports.jsp
inDate.hours cannot be resolved or is not a field
When I access that section now; debugging code above the scriptlet has
proven that inDate & outDate are getting their proper values in the
JSP code, though.
Here's a little bit of the code; I'm pretty sure this issue is just
something that I don't understand about either the scope of these
objects (declared at the top of the same JSP page) or how much access
an embedded scriptlet has to variables declared in JSP:
<fmtarseDate var="inDate" value="${punch.starttime}"
pattern="yyyy-MM-dd HH:mm:ss" />
<fmtarseDate var="outDate" value="${punch.endtime}" pattern="yyyy-
MM-dd HH:mm:ss" />
<%
int totalMinutes = 0, units = 0;
if (inDate.hours != outDate.hours)
totalMinutes = (outDate.hours - inDate.hours) * 60;
totalMinutes += (outDate.minutes - inDate.minutes);
if ((totalMinutes >= 8) && (totalMinutes <= 22))
units = 1;
else if (totalMinutes >= 23) {
units = 1;
totalMinutes -= 22;
do {
units += 1;
totalMinutes -= 15;
} while (totalMinutes > 0);
}
%>
I would be very grateful if anybody could help point me in the right
direction on this issue.
Damon Getsman
a bit of actual code scriptlet embedded with <% ... %> tags now.
In the jsp above that scriptlet I'm working with 2 objects of
java.util.Date, called inDate and outDate. When I'm trying to access
the different objects er values or whatever within them, I'm using
standard inDate.minutes and etc. to attempt to do tests on them. Is
there something special that I need to know about accessing this kind
of object from within an embedded scriptlet? I'm getting a server log
error of
An error occurred at line: 169 in the jsp file: /reports.jsp
inDate.hours cannot be resolved or is not a field
When I access that section now; debugging code above the scriptlet has
proven that inDate & outDate are getting their proper values in the
JSP code, though.
Here's a little bit of the code; I'm pretty sure this issue is just
something that I don't understand about either the scope of these
objects (declared at the top of the same JSP page) or how much access
an embedded scriptlet has to variables declared in JSP:
<fmtarseDate var="inDate" value="${punch.starttime}"
pattern="yyyy-MM-dd HH:mm:ss" />
<fmtarseDate var="outDate" value="${punch.endtime}" pattern="yyyy-
MM-dd HH:mm:ss" />
<%
int totalMinutes = 0, units = 0;
if (inDate.hours != outDate.hours)
totalMinutes = (outDate.hours - inDate.hours) * 60;
totalMinutes += (outDate.minutes - inDate.minutes);
if ((totalMinutes >= 8) && (totalMinutes <= 22))
units = 1;
else if (totalMinutes >= 23) {
units = 1;
totalMinutes -= 22;
do {
units += 1;
totalMinutes -= 15;
} while (totalMinutes > 0);
}
%>
I would be very grateful if anybody could help point me in the right
direction on this issue.
Damon Getsman