Hi ,
I am facing problem in my very first JSP and BEAN
I am using JWS2.0
MY coding for bean is
////////////
package test;
import javax.servlet.http.*;
import java.util.Vector;
import java.util.Enumeration;
import java.sql.*;
public class BrokerList {
protected String dbURL = "jdbc:odbc:broking1";
protected Connection dbConnection;
Vector vectorBrokerName = new Vector();
Vector vectorBrokerCode = new Vector();
public BrokerList() {
super();
}
public Connection getConnection()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Driver Registered");
} catch (Exception e){
System.out.println( e.getMessage());
System.out.println("Please retry the Driver
egistration");
}//end of catch
try {
dbConnection =
DriverManager.getConnection("jdbc:odbc:broking1","","");
}catch (Exception e){
e.getMessage();
}//end of catch
return dbConnection ;
}
public void setBrokerName() {
try{
String strQryBrName = "select broker_name from BROKER_MASTER
";
Connection con = this.getConnection();
Statement stmtbrkname = con.createStatement();
ResultSet rsbrname = stmtbrkname.executeQuery(strQryBrName);
while(rsbrname.next())
{
vectorBrokerName.addElement(rsbrname.getString("broker_name"));
}
rsbrname.close();
stmtbrkname.close();
}catch(SQLException se)
{
se.getMessage();
}
}
public void setBrokerCode() {
try{
String strQryBrCode = "select broker_code from
BROKER_MASTER ";
Connection con1 = this.getConnection();
Statement stmtbrkcode = con1.createStatement();
ResultSet rsbrcode =
stmtbrkcode.executeQuery(strQryBrCode);
while(rsbrcode.next())
{
vectorBrokerCode.addElement(rsbrcode.getString("broker_code"));
}
rsbrcode.close();
stmtbrkcode.close();
}catch(SQLException se){
se.getMessage();
}
}
public Vector getBrokerNames() {
return vectorBrokerName;
}
public Vector getBrokerCodes() {
return vectorBrokerCode;
}
}
////////
My JSP page
///////
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>EDIT INVESTOR REGISTRATION</title></head>
<jsp:useBean id="brokerlist" scope="session"
class="sunexamples.beans.BrokerList" />
<jsp:setProperty name="brokerlist" property="*" />
<jsp:getProperty name="brokerlist" property="*" />
<FONT size = 5 COLOR="#CC0000">
<br> You have the following items in your cart:
<ol>
<%
Vector vname = new Vector();
Vector vcode = new Vector();
vname = brokerlist.getBrokerNames();
vcode = brokerlist.getbrokerCodes();
System.out.println("vname"+vname);
System.out.println("vcode"+vcode);
if(vname.size() > 0)
{
for (int i=0; i<vname.size(); i++) {
%>
<li> <%= vcode.elementAt(i) %>
<%
}
}
%>
</ol>
</FONT>
<hr>
</html>
</head>
the error is
Error during compilation :
C:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_examples\_jsp\_samples\_test\_chtest.java:18:
'}' expected.
static char[][] _jspx_html_data = null;
^
1 error
thanks in advance
sanjeev
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html