Solved

Applets + JavaBeans

Posted on 2003-11-10
4
286 Views
Last Modified: 2013-11-24
Hi,

The problem is that I'm developing some graphical reports with (java AWT-Swing) so I'm using applets.

The question: is there any way to use JavaBeans with applets. The thing is that I need to access my database throw an Applet. The code is down below (no errors...no results... and there is nothing in logs either).

The thier arrangment is :    Web browser<--> Apache <--> Tomcat <--> PostgreSQL

Any ideas... ? Any solutions... ? I'm open to sugestions even if I have to throw to the waste basket my applets and starting to use some servlets or something like that.

*************************************************
import java.awt.*;
import java.awt.*;
import java.applet.Applet;
import Biblioteca.ConexionBean;

public class Prueba extends Applet {
  public void init() {
    ConexionBean base;
    base = new ConexionBean();
    String p_cveproyecto = getParameter("p_cveproyecto");
    String sql = "";

    add(new Label("Clave del proyecto"));
    add(new Label(base.Prueba(p_cveproyecto), Label.RIGHT));
  }
}

Thanks in advance!
0
Comment
Question by:lowg
4 Comments
 
LVL 2

Accepted Solution

by:
incongruent earned 125 total points
ID: 9719198
What you need to do is create a ObjectOutputStream/ObjectInputStream from your servlet to your applet.  (Client - Server architecture).  

You servlet must access the database and construct a 'DataObject'.  I am currently working on an applet that gets dataobjects in an arraylist via the OOS/OIS then performs a method to construct the tree from the arraylist.

If you're looking for a direct database connection from your applet to the database,  you would require a signed servlet.  To sign a servlet you need to get a certificate from Verisign or something along those lines.  

I suggest you revise your reporting function to use an arraylist of dataobjects instead of a direct data connection.   Have the servlet perform the data connections and SQL queries and fill arraylist(s) with dataobjects constructed from SQL queries.  Then send those arraylists of ObjectOutputStream via the servlet.



-Allan
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question