Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Applets + JavaBeans

Posted on 2003-11-10
4
Medium Priority
?
292 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 500 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

886 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