dcsimg
xx(class name) cannot be resolved to a type
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jo_se
Posted On:   Thursday, February 16, 2006 12:37 AM

login 1.first i create a database in mysql 2.then i create a jsp page for welcome 3.another jsp page to view the result 4.in that second jsp page i call java for connection and to insert the values. now i am getting error. if anyone knows it means plz tel my first jsp page Project id                      Project Name                 Client Name                   Project Start Date           Est Project End Date         More>>
login

1.first i create a database in mysql
2.then i create a jsp page for welcome
3.another jsp page to view the result
4.in that second jsp page i call java for connection and to insert the values.

now i am getting error.
if anyone knows it means plz tel

my first jsp page

			









Project id                     




Project Name
               




Client Name                  




Project Start Date
         




Est Project End Date
    




Project Manager
           




Est Effort                       














my java page

			

package ss;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.*;

class base
{
PreparedStatement pstmt=null;
Connection con = null;
Statement stmt = null;
ResultSet rset = null;

void add(String proj_id,String proj_name,String client_name,String strt_date,String est_date,String proj_mgr,int est_effort )
{

try
{

String driverName = "com.mysql.jdbc.Driver";
Class.forName(driverName);

String serverName = "192.168.10.5";
String mydatabase = "Trainees";
String url = "jdbc:mysql://" + serverName + "/" + mydatabase; // a JDBC url
String username = "josep";
String password = "josep";
con = DriverManager.getConnection(url, username, password);
System.out.println("Connected");

}

catch(Exception e)
{
System.err.println("Exception: " + e.getMessage());
}


try{
System.out.println("Before Update1");


pstmt=con.prepareStatement("insert into project(proj_id,proj_name,client_name,strt_date,est_date,proj_mgr,est_effort) values (?,?,?,?,?,?,?)");


System.out.println("Before Update2");
pstmt.setString(1,proj_id);
pstmt.setString (2,proj_name);
pstmt.setString (3,client_name);
pstmt.setString (4,strt_date);
pstmt.setString (5,est_date);
pstmt.setString(6,proj_mgr);
pstmt.setInt(7,est_effort);

pstmt.executeUpdate();
System.out.println("" +pstmt );

}
catch(Exception e)
{
System.err.println("Exception: " + e.getMessage());
}

finally
{
try
{
if(con != null)
con.close();
}
catch(SQLException e)
{
}
}

}

void modify()
{

}
void delete()
{

}
void assign()
{

}
}
public class xx extends base
{

public static void main(String args[]) throws IOException
{
base a= new base();
a.add();
}
}



my second jsp page

			

<%@ page language="java"%>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*"%>
<%@ page import= "ss.xx.*" %>



Welcome

Welcome...


<%
xx ab=new xx();
ab.add(proj_id,proj_name,client_name,strt_date,est_date,proj_mgr,est_effort);
%>
<%
String Project_id = request.getParameter("proj_id");
String Project_name=request.getParameter("proj_name");
String client_name=request.getParameter("client_name");
String start_date=request.getParameter("strt_date");
String estimated_date=request.getParameter("est_date");
String Project_mgr=request.getParameter("proj_mgr");
int est_effort=Integer.parseInt(request.getParameter("est_effort"));
%>


Project id :  <%= Project_id%>


Project Name :  <%= Project_name%>


Client Name :  <%= client_name%>


Project Start Date :  <%= start_date%>


Est Project End Date :  <%= estimated_date%>


Project Manager :  <%= Project_mgr%>


Est Effort :  <%= est_effort%>









But when i run the program, am getting an error :

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


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
xx cannot be resolved to a type


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
xx cannot be resolved to a type


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
proj_id cannot be resolved


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
proj_name cannot be resolved


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
client_name cannot be resolved


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
strt_date cannot be resolved


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
est_date cannot be resolved


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
proj_mgr cannot be resolved


An error occurred at line: 12 in the jsp file: /project.jsp
Generated servlet error:
est_effort cannot be resolved


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

   <<Less

Re: xx(class name) cannot be resolved to a type

Posted By:   venkatesh_p  
Posted On:   Thursday, February 16, 2006 03:37 AM

In your java program, you have passed 7 arguments in the add method, and you are calling the method with no arguments in the java.. How did your program got compiled?
please verify the java program first and then try executing the jsp page.

Re: xx(class name) cannot be resolved to a type

Posted By:   Anonymous  
Posted On:   Thursday, February 16, 2006 02:51 AM

Your second jsp page has mistakes. First of all

you are using xx class and you have given the import statement as <%@ page import= "ss.xx.*" %>

It should be ><%@ page import= "ss.xx" %>

Then correct your jsp page and work it out
About | Sitemap | Contact