Solved

Applets + JavaBeans

Posted on 2003-11-10
4
287 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 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
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…

730 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