• Post Reply Bookmark Topic Watch Topic
  • New Topic

how can use JTable in a JSP page  RSS feed

 
samir mohamed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Is it possible to display a JTable in the the JSP page?
Could you please provide a simple sample code

Regards
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not directly. You'd need to use an applet.
 
samir mohamed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

If I use the applet that contains the JTable
how can I access the JTable from within the JSP page?

In the following example, the applet's name is MyApplet, in the package jspapplet. The JSP code is as follows :

<%@ page language="java" import="java.util.*, jspapplet.*" pageEncoding="ISO-8859-1"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

</head>

<body>

<applet
codebase = "."
code = "jspapplet.MyApplet.class"

name = "TestApplet"
width = 400
height = 300
hspace = 0
vspace = 0
align = top
>
</applet>

</body>
</html>


my question is, how can I access the JTable which is inside the Applet from the jsp page

Best Regards
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't.

The applet and the JSP will be run under two different JVMs in two different places, and, for the most part at two different times.

The JSP, in this case is doing nothing more than telling the browser where to get the files needed for running the applet.

What, exactly, are you trying to do?
 
samir mohamed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply

I am trying to display a database in a JSP page, where the user can select one row and click a button command like delete, or diplay details, etc,

could you please help me on doing that?
Best Regards
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, in that case you should step back to before the point where you decided a JTable would be a good tool for that. You will find it a lot easier to use plain old HTML tables in your browser and have servlets do the the database work. This type of application is so common that people refer to it as a CRUD application (standing for Create, Retrieve, Update, Delete).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!