• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Embedding java applications in a web page with JSP

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, forgive my ignorance at the outset if this is an obvious and/or stupid question!

I have created a free standing java application which is basically a frame with some buttons in it:

import java.awt.*;
import java.awt.event.*;


public class FrameTester
{
public static void main (String[] args)
{
TempFrame frame = new TempFrame();
frame.setTitle("Frame Test");
frame.setVisible(true);

}
}
class TempFrame extends Frame implements ActionListener
{
//TempFrame constructor
public TempFrame()
{
//set framesize
final int DEFAULT_FRAME_WIDTH = 250;
final int DEFAULT_FRAME_HEIGHT = 150;
setSize (DEFAULT_FRAME_WIDTH, DEFAULT_FRAME_HEIGHT);
//Using GridLayout manager
setLayout (new GridLayout(4,2));
setLocation(100,100);
setTitle("Students - Main Menu");

close = new Button("close");
close.addActionListener(this);
add(close);

inputBox = new Button("Input test");
inputBox.addActionListener(this);
add(inputBox);

testDialog = new TestDialog(this);
}


public void actionPerformed(ActionEvent e)
{

if (e.getSource()==close)
System.exit(0);

else if(e.getSource()==inputBox)
testDialog.setVisible(true);
}

private Button close, inputBox;
private Dialog testDialog;

}

class TestDialog extends Dialog implements ActionListener

{
public TestDialog(Frame f)
{
super(f,true);
setSize (600,500);
setTitle ("Test Writer");
setLocation(300,100);
setLayout(new GridLayout(2,2));
add(new Label("general input"));
student_number=new TextField(10);
//student_number.addKeyListener(this);
add(student_number);

clear=new Button("Clear (close!)");
clear.addActionListener(this);
add(clear);
}

public void actionPerformed(ActionEvent e)
{
if (e.getSource()==clear)
System.exit(0);
}


private Button clear;
private TextField student_number;
}

and I want to embed the frame "frame" in a web page.

Is there a way of using JSP (Beans or some other method) to embed this code into a web page, without substantially rewriting my code. Any tips or pointers in the right direction, most appreciated.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a perfect scenario for applets.
 
reply
    Bookmark Topic Watch Topic
  • New Topic