calling a constructor in jsp
843836Sep 3 2003 — edited Sep 3 2003what is wrong with this code in the jsp,
<%@page contentType="text/html"%>
<%@page import="java.util.*, Test.*" %>
<%@page import="java.io.*" %>
<html>
<head><title>Search Results</title></head>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<body>
<jsp:useBean id = "zn" class="Test.Zone" scope="session" />
<%
float Nor = Float.parseFloat(request.getParameter( "north" ));
float Sou = Float.parseFloat(request.getParameter( "south" ));
float Eas = Float.parseFloat(request.getParameter( "east" ));
float Wes = Float.parseFloat(request.getParameter( "west" ));
zn.Zone(Nor, Sou, Eas, Wes);
float lo = zn.getLongitude();
out.print("Longitude " +lo);
%>
I get this error message
Reply$jsp.java [376:1] cannot resolve symbol
symbol : method Zone (float,float,float,float)
location: class Test.Zone
zn.Zone(Nor, Sou, Eas, Wes);
^
1 error
Errors compiling Reply.
note the Zone(float,float, float,float) is a constructor of the class Test.Zone defined below
public Zone(float jeast, float jwest, float jnorth, float jsouth){
float latmid;
float latrange;
float lonmid;
float lonrange;
// check for east bigger than west
if( east > west ){
latrange = ( east - west ) / 2;
latmid = ( east - latrange );
this.latitude = latmid;
this.latitudeRange = latrange;
}
// check for west bigger than east
else if ( west > east ) {
latrange = ( west - east ) / 2;
latmid = ( west - latrange );
this.latitude = latmid;
this.latitudeRange = latrange;
}
else System.out.println("Error calculating latitude");
// check for north bigger than south
if ( north > south ){
lonrange = ( north - south ) / 2;
lonmid = ( north - lonrange ) ;
this.longitude = lonmid;
this.longitudeRange = lonrange;
}
else if ( south > north ){
lonrange = ( south - north ) / 2;
lonmid = ( south - lonrange ) ;
this.longitude = lonmid;
this.longitudeRange = lonrange;
}
else System.out.println("Error calculating longitude");
}
why does JSP not find the constructor and how do i solve this, please?