JSP problem
I deployed it through deployment tool 8.2 and put it in docroot ..
Both of there holding the same error...
error:
1
[javac]BankAccount BA =null;
[javac]^
2
[javac] BA = (BankAccount) _jspx_page_context.getAttribute("BA", PageContext.APPLICATION_SCOPE);
[javac]^
3
[javac]BA =new BankAccount();
[javac]^
[javac] 3 errors
Woud anybody know where is the problem...
I compiled the bankaccount.java and put it in the classes inside lib is it any path to be set...(docroot)
This is the main interface of my program
//filename : Usebeanexample.jsp
<html>
<head><title>User Validation</title></head>
<body bgcolor ="#fffffr">
<form method ="post" action ="Usebean.jsp">
<table border ="0" cellspacing ="1" cellpadding="5">
<tr>
<td width ="100"> </td>
<td align ="right"><h1><font color ="red">Welcome to Earnest bank</font></h1></td>
</tr>
<tr>
<td width ="100" align ="right"><b><font color ="blue">Account ID:</font></b></td>
<td align ="left"><input type ="text" name ="sAccountId" size ="30"></td>
</tr>
<tr>
<td width ="100" align ="right"><b><font color ="blue">Pin number</font></b></td>
<td align ="left"><input type ="password" name ="sPin" size ="30"></td>
</tr>
<tr>
<td width ="100"> </td>
<td align ="right"></td>
</tr>
<tr>
<td width ="100"> </td>
<td align ="left"><input type ="submit" value ="submit"></td>
</tr>
</table>
</form>
</body>
</html>
Bean class
//filename Usebean.jsp
<%@ page language ="java" %>
<jsp:useBean id ="BA" scope ="application"class ="BankAccount" />
<jsp:setProperty name ="BA" property ="sAccountID" param ="sAccountID" />
<jsp:setProperty name ="BA" property ="sPin" param ="sPin" />
<html>
<head><title>TITLE</title></head>
<body>
<%
String sAccountID = BA.getsAccountID();
String sPin = BA.getsPin();
boolean validate = BA.AccountValidate();
if(validate ==true)
{
out.println("The user is validated");
}
else
{
out.println("The user is not valid");
}
%>
</body>
</html>
java
//BankAccount.java
import java.io.*;
import java.sql.*;
publicclass BankAccount
{
private String sAccountID =" ";
private String sPin =" ";
Connection connect =null;
Statement state =null;
ResultSet result =null;
publicvoid setsAccountID(String sAccountID)
{
this.sAccountID = sAccountID;
}
publicvoid setsPin(String sPin)
{
this.sPin = sPin;
}
public String getsAccountID()
{
return sAccountID;
}
public String getsPin()
{
return sPin;
}
public BankAccount()throws ClassNotFoundException
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
publicboolean AccountValidate()
{
boolean validate =false;
String sPinNo="";
try
{
sAccountID = getsAccountID();
sPin = getsPin();
connect = DriverManager.getConnection("jdbc:odbc:MyDataSource","sa","");
String strQuery ="select cPin_no from login where cAccount_id = '"+sAccountID+"'";
state = connect.createStatement();
ResultSet result = state.executeQuery(strQuery);
while(result.next())
{
sPinNo = result.getString(1);
}
sPinNo = sPinNo.trim();
sPin = sPin.trim();
if(sPinNo.equals(sPin))
{
validate =true;
}
}
catch(Exception e)
{
}
return validate;
}
}

