Nirmala Devi

Greenhorn
+ Follow
since Jul 31, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nirmala Devi

I am trying to execute a java program from JSP, which will return a ResultSet to JSP. I am getting the Class not found error.
Part of my JSP:
<%@ page contentType="text/xml" %>
<%@ page import="java.sql.*" %>
<jsp:useBean id="dbconnectbean" scope="page" class="DBConnectBean"/>
<%!
ResultSet rs=null;
ResultSetMetaData rsmd=null;
int count;
%>
<resultset>
<%
rs=dbconnectbean.getResult(); ----> ERROR IN THIS LINE
My Java program:
import java.util.*;
import java.sql.*;
import java.io.*;
import java.text.*;
public class DBConnectBean implements Serializable {
private Connection con = null;
private String url;
private String userLogin;
private String password;
private static final String empID = "EMP1002";
public ResultSet rs = null;
private Statement stmt = null;
private PrintWriter out = null;
private String SQL;
static {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (Exception e) {
System.out.println("Can't get the driver");
e.printStackTrace();
}
}
public DBConnectBean() {
url=null;
userLogin=null;
password=null;
SQL=null;
}
public ResultSet getResult() throws SQLException
{
try {
url="jdbc dbc:JSPTest";
userLogin="guest";
password="guest";
con = DriverManager.getConnectionurl,userLogin, password);
} catch (Exception e) { e.printStackTrace(); }
try {
SQL="select * from employee_mst;
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
} catch (Exception e) { out.println ("Exception " + e ; }
return rs;
}
}
The error is:
org.apache.jasper.JasperException: Unable to compile class for JSPD:\jakarta-tomcat-3.2.3\work\localhost_8080%2Fexamples\_0002fjsp_0002fxmldb_0002ejspxmldb_jsp_2.java:73: Class jsp.DBConnectBean not found.
DBConnectBean dbconnectbean = null;
Any help is appreciated.
Regds
Devi
22 years ago

How do I parse an XML, which is stored in a String?
Assume the string name is xmlString. It contains 'employee' as root node and firstname, lasename, address as child node.

I tried the following with xml4J parser.
1. Create a parser object
Parser p = new Parser("parser.err");
2. converting a string into an inputstream.
ByteArrayInputStream is = new ByteArrayInputStream(xmlString.getBytes());

3. Create the DOM tree
TXDocument document = parser.readStream(is);
here, document(DOM tree) is null. So, I am not able to get the root element. Why is that???
Thanks


I have a question related to displaying the Database records using XML. I had gone through the eleven rules for moving a relational database to XML by Kevin Williams. All the rules are clear. But when I try to create an XML to do this, I am confused.
Details�.
After explaining all the eleven rules, the author creates the following DTD.
<!ELEMENT SalesData (Invoice*, Customer*, Part*, MonthlyTotal*)>
<!ATTLIST SalesData
Status (NewVersion | UpdateVersion | CourtesyCopy) #REQUIRED>
<ELEMENT Invoice (LineItem*)>
<ATTLIST Invoice
InvoiceNumber CDATA #REQUIRED
TrackingNumber CDATA #REQUIRED
OrderDate CDATA #REQUIRED
ShipDate CDATA #REQUIRED
ShipMethod (USPS | FedEx | UPS) #REQUIRED
��
(For the sake of discussion, I included only Invoice table here)
How do I create an XML for the above DTD, which displays all the records (say 10 records) from the Invoice database.???
I couldn't understand the XML, which is given by Kevin. How the values are coming from invoice table into this XML??
Any explanation is appreciated.
Regards
Devi