Undefined variable error

I defined the two variables upper_limit and lower_limit in my bean but I get an undefined variable message when I try to use them in my jsp page. Can anyone see what the problem is?

JSP code:

I'm thinking of a number between <%=lower_limit%> and <%=upper_limit%>.<p>

error message:

org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.1\work\localhost_8080%2Fexamples\_0002fjsp_0002fnum_0002fnumguess_00031_0002ejspnumguess1_jsp_0.java:157: Undefined variable: lower_limit

out.print(lower_limit);

^

C:\jakarta-tomcat-3.2.1\work\localhost_8080%2Fexamples\_0002fjsp_0002fnum_0002fnumguess_00031_0002ejspnumguess1_jsp_0.java:163: Undefined variable: upper_limit

out.print(upper_limit);

[815 byte] By [mpburke] at [2007-9-26 2:24:47]
# 1

> I defined the two variables upper_limit and

> lower_limit in my bean but I get an undefined variable

> message when I try to use them in my jsp page. Can

> anyone see what the problem is?

If these are defined in your bean this doesn't mean that you can access them directly from your JSP page.

try the <jsp:getProperty name="beanName" property="lower_limit"/> and <jsp:getProperty name="beanName" property="upper_limit"/>

>

>

> JSP code:

> I'm thinking of a number between <%=lower_limit%>

> > and <%=upper_limit%>.<p>

I believe that's what these error codes are suggesting, not that you haven't defined the variable in your Bean, but that you haven't gotten the variable from the Bean.

>

> error message:

> org.apache.jasper.JasperException: Unable to compile

> class for

> JSPC:\jakarta-tomcat-3.2.1\work\localhost_8080%2Fexampl

> s\_0002fjsp_0002fnum_0002fnumguess_00031_0002ejspnumgue

> s1_jsp_0.java:157: Undefined variable: lower_limit

> out.print(lower_limit);

> ^

> C:\jakarta-tomcat-3.2.1\work\localhost_8080%2Fexamples\

> 0002fjsp_0002fnum_0002fnumguess_00031_0002ejspnumguess1

> jsp_0.java:163: Undefined variable: upper_limit

> out.print(upper_limit);

>

Hope that helps some,

Bryan

bryanwclark at 2007-6-29 9:34:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I tried using getProperty but now I get the error message below:

Cannot find a method to read property 'lowerLimit' in a bean of type 'num.NumberGuessBean'

jsp code:

I'm thinking of a number between <jsp:getProperty name="numguess" property="lowerLimit"/> and <jsp:getProperty name="numguess" property="upperLimit"/>.<p>

I've defined my methods as getLowerLimit(), getUpperLimit()...

The variables are defined as lowerLimit and upperLimit.

mpburke at 2007-6-29 9:34:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...