tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <JDNovo...@lbl.gov>
Subject jsp function declaration
Date Thu, 26 Apr 2001 18:43:45 GMT

Hi,

    I have  a very simple JSP function that looks like:

<%! public String isSelected(String var, String checkvar) {
             if (var.equals(checkvar)) {
                 return "selected";
             } else
                 return "";
             }
        }
%>

    Only problem is whenever I load my page, I get the following error:

org.apache.jasper.JasperException: Unable to compile
/usr/local/tomcat/tomcat-3.3-m2/work/DEFAULT/demo/jsp/filetransfer/showfiles_1.java:25:
Class or interface declaration expected.
    static {
    ^
/usr/local/tomcat/tomcat-3.3-m2/work/DEFAULT/demo/jsp/filetransfer/showfiles_1.java:13:
class jsp.filetransfer.showfiles_1 must be declared abstract. It does
not define void _jspService(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) from class
org.apache.jasper.runtime.HttpJspBase.
public class showfiles_1 extends org.apache.jasper.runtime.HttpJspBase {

             ^
2 errors


    I've tried adding thsi snippet to the numguess.jsp example without
any problem and all the books I've read indicate this is perfectly
acceptable programming.

    Any ideas, why adding methods doesn't work with my page?

    Thanks very much, Jason


--
Jason Novotny               novotny@george.lbl.gov
Home: (510) 610-8360        Work: (510) 486-8662
NERSC Distributed Computing http://www-didc.lbl.gov




Mime
View raw message