I am trying to get this JSP to work in the JSP Bean. Please advise what I am doing wrong?
Here is my Java file called myTherm.java which compiles with no problems:
My JSP with the Bean call here:
Error messages here:
Generated servlet error:
[javac] Compiling 1 source file
C:\jakarta-tomcat-4.1.27\work\Standalone\localhost\examples\jsp\colors\myTherm_jsp.java:55: cannot resolve symbol
symbol : class myTherm
location: class org.apache.jsp.myTherm_jsp
myTherm t = new myTherm(34);
^
An error occurred at line: 2 in the jsp file: /jsp/colors/myTherm.jsp
Generated servlet error:
C:\jakarta-tomcat-4.1.27\work\Standalone\localhost\examples\jsp\colors\myTherm_jsp.java:55: cannot resolve symbol
symbol : class myTherm
location: class org.apache.jsp.myTherm_jsp
myTherm t = new myTherm(34);
^
2 errors
Here is my Java file called myTherm.java which compiles with no problems:
Code:
package colors;
public class myTherm
{
private int temp;
private int maxTemp;
private int minTemp;
public myTherm()
{
this(34);
}
public myTherm(int temp)
{
this.temp = temp;
init();
}
public void setTemp(int temp)
{
this.temp = temp;
init();
}
public int getTemp()
{
return temp;
}
private void init()
{
maxTemp = this.temp + 10;
minTemp = this.temp = 20;
if(maxTemp > 150)
System.out.println("above");
else
System.out.println("below");
}
}
My JSP with the Bean call here:
Code:
<jsp:useBean id="myStat" class="colors.myTherm">
</jsp:useBean>
<html>
<body>
<% myTherm t = new myTherm(34); %>
The data is now <%= myStat.getTemp() %> data.
</body>
</html>
Generated servlet error:
[javac] Compiling 1 source file
C:\jakarta-tomcat-4.1.27\work\Standalone\localhost\examples\jsp\colors\myTherm_jsp.java:55: cannot resolve symbol
symbol : class myTherm
location: class org.apache.jsp.myTherm_jsp
myTherm t = new myTherm(34);
^
An error occurred at line: 2 in the jsp file: /jsp/colors/myTherm.jsp
Generated servlet error:
C:\jakarta-tomcat-4.1.27\work\Standalone\localhost\examples\jsp\colors\myTherm_jsp.java:55: cannot resolve symbol
symbol : class myTherm
location: class org.apache.jsp.myTherm_jsp
myTherm t = new myTherm(34);
^
2 errors