Greetings!
I saw servlet, and I jumped. I did not go to the site. Can you tell us a little more? Can you add the full code, you might get better luck that way...
Have a look here meanwhile, I could not say too much was understandable but I did get the fact that you need to retrieve something:
-
-
//import packages/libraries
-
-
import java.io.*;
-
import java.sql.*;
-
import javax.servlet.*;
-
import javax.servlet.http.*;
-
-
//start you request
-
public class NameOfYourServlet extends HttpServlet{
-
public void doGet(HttpServletRequest request,
-
HttpServletResponse response) throws
-
ServletException, IOException{
-
-
//tell the servlet the type of gui the results will load in, in this case, HTML...
-
-
response.setContentType("text/html");
-
PrintWriter pw = response.getWriter();
-
-
//You should have had an ODBC connection ready,
-
//with a DataSource name Northwind.
-
//Your database name can be anyhting,
-
//The datasource is most important here.
-
-
String connectionURL = "jdbc:odbc:Northwind";
-
Connection connection=null;
-
try{
-
-
//Connect to the odbc driver specific to Sun Microsystems' platform(s)...
-
-
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
-
connection = DriverManager.getConnection(connectionURL, "root", "root");
-
-
//it is advisable to use a preparedStatement here, but this should do...
-
//Begin running the query to retrieve userid and password info.
-
-
Statement st = connection.createStatement();
-
ResultSet rs = st.executeQuery("Select * from YourTable");
-
while(rs.next()){
-
-
//add the result to an HTML page, no graphics, but you'll get the point...
-
-
pw.println("YourName" + " " + "YourPassword" + "<br>");
-
pw.println(rs.getString(1) + " " + rs.getString(2) + "<br>");
-
}
-
}
-
-
//barring any unforseen adventures withe code, you should be good to go...
-
//but in the case there are problems, it will be caught here.
-
//Also see above where the exception is defined.
-
-
catch (Exception e){
-
pw.println(e);
-
}
-
}
-
}
-
We hope you have a bit of xml experience, you'll need it going forward. Below however is prety simple but needed to make available the servlet, in conjunction to the HTML gui:
-
-
<?xml version="1.0" encoding="ISO-8859-1"?>
-
<!--<!DOCTYPE web-app
-
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-
"http://java.sun.com/dtd/web-app_2_3.dtd"> -->
-
-
<web-app>
-
<servlet>
-
<servlet-name>FancyServlet</servlet-name>
-
<servlet-class>YourServletName</servlet-class>
-
</servlet>
-
<servlet-mapping>
-
<servlet-name>FancyServlet</servlet-name>
-
<url-pattern>/YourServletName</url-pattern>
-
</servlet-mapping>
-
</web-app>
-
-
web.xml file is crucial to firing you HTML, without it your Servlet will not run...
Hope this is what you're looking for. I would also search here just to see if anything's posted.
In a bit!