?
Solved

Applets + JavaBeans

Posted on 2003-11-10
4
Medium Priority
?
290 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 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