org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 39 in the jsp file: /jsp/cyberlog.jsp
The type of the expression must be an array type but it resolved to int
36: count=rs.getRow();
37: //count=rs.getInt(1);
38: }
39: if(count[0] > 1){
40: pw.println("<font color=green size=5>welcome!!!</font>");
41: }
42: else{
Here is the code. any help thanks
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<html>
<head>
<title>login</title>
</head>
<body>
<%
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
String username = request.getParameter("username");
String password = request.getParameter("password");
int count=0;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con=null;
ResultSet rst=null;
Statement stmt=null;
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/vat", "root", "root");
stmt=con.createStatement();
String query = "select count from vat where username='"+username+"' and password='"+password+"'";
System.out.println(query);
ResultSet rs = stmt.executeQuery(query);
while(rs.next()){
count=rs.getRow();
//count=rs.getInt(1);
}
if(count[0] > 1){
pw.println("<font color=green size=5>welcome!!!</font>");
}
else{
pw.println("<font color=red size=5>Please insert valid Username and Password mea!</font>");
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
%>
thanks


Sign In
Create Account


Back to top









