Hi everyone,

I am trying to use classes with JSP but I have a problem. I created a class and a method that will be used to return a specific querystring value . But I get an error while compiling the class and I can't solve the problem.

I use Apache Tomcat & J2SE on Windows XP Pro. SP2.

The class I wrote :

public class pageIdentification
{
    private String process;

    public pageIdentification(){}

    public String deneme (){
        process = request.getParameter("process");
        return (process);
    }

}

and the error I get :

>javac pageIdentification.java
pageIdentification.java:8: cannot find symbol
symbol  : variable request
location: class pageIdentification
                process = request.getParameter("process");
                          ^
1 error

Could anyone help me please?

The request object in a servlet is a passed in Object, not some sort of magical reference. You would have to rewrite this to either pass the request object into the called method or retrieve it from the ServletContext. But, in either case, you will also need to import a couple of further classes from the J2EE packages.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.