aspose file tools*
The moose likes JSP and the fly likes Cannot be resolved to a type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Cannot be resolved to a type" Watch "Cannot be resolved to a type" New topic
Author

Cannot be resolved to a type

Zoram Paul
Ranch Hand

Joined: Jul 10, 2007
Posts: 59
Hello everybody,

An error occurred while executing these codes

<%@page import="examples.simple.ActiveClass" %>

try
{
String userId=request.getParameter("userID");
String activateCode=request.getParameter("activationCode");

ActiveClass object=new ActiveClass();
String status=object.Activate(userId);

if(status.equals("success"))
{
out.println("Ok");
}
}
catch(Exception e)
{
}

The error displayed was:

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 25 in the jsp file: /simple/activeAccount.jsp
ActiveClass cannot be resolved to a type
22: String userId=request.getParameter("userID");
23: String activateCode=request.getParameter("activationCode");
24:
25: ActiveClass object=new ActiveClass();
26: String status=object.Activate(userId);
27:
28: if(status.equals("success"))


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



Can anyone help me out please?


Thanks


ZORAM<br />"If it's true that we are here to help others,<br />then what exactly are the others here for?"
Tarun Yadav
Ranch Hand

Joined: Sep 20, 2007
Posts: 134
Your class can't be found...where have you placed it?

Take a look at this detailed discussion and solutions:
http://forum.java.sun.com/thread.jspa?threadID=707833&messageID=4136842
Zoram Paul
Ranch Hand

Joined: Jul 10, 2007
Posts: 59
This is the java class:



/*
* ActiveClass.java
*
* Created on August 31, 2007, 3:04 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package examples.simple;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;

import examples.sql.connect;

/**
*
* @author Administrator
*/
public class ActiveClass {

int userId;

Connection con=null;

/** Creates a new instance of ActiveClass */
public ActiveClass() {
}


public String Activate(String userId)
{
this.userId=Integer.parseInt(userId);

try
{
connect conn=new connect();
con=conn.createConnection();
Statement stmt=con.createStatement();

String sql="UPDATE registered_user SET user_privileges='Y' WHERE user_id = "+this.userId;

if(stmt.executeUpdate(sql)==1)
return "success";
else
return "failure";
}
catch (SQLException ex)
{
ex.printStackTrace();
return "failure";
}

}

}


Is there any problem with that?

Please suggest.
Zoram Paul
Ranch Hand

Joined: Jul 10, 2007
Posts: 59
Hurray.............

I have done it myself...............



Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
What did you do to fix it? Please post solution so that other people may benefit from your experience.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot be resolved to a type
 
Similar Threads
When JSP page is compiled?
Compile .java file on JSP
JDK 6 UPDATE 15, Includes JWSDP so it does not need install separatelly, like 5 ver?
Can't deploy code for taglibs on Tomcat 5.5
error - hashtable cannot be resolved to a type error