aspose file tools*
The moose likes JSP and the fly likes How to put Swing components in a JSP page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to put Swing components in a JSP page?" Watch "How to put Swing components in a JSP page?" New topic
Author

How to put Swing components in a JSP page?

Jen Yang
Greenhorn

Joined: Jul 07, 2003
Posts: 11
Hi,
Does anybody have an example of how to put a Swing component in a JSP page? I need to use a JTable which contains some data from a database table. When I double click one row for example, it can take me to another JSP page to display the detail. Thanks a lot!!
Johanna Sousa
Greenhorn

Joined: Jul 18, 2003
Posts: 2
You can't use Swing components in a JSP. Sorry.
I think the display tag library has the functionality that you're looking for though:
http://edhill.its.uiowa.edu/display
http://sourceforge.net/projects/displaytag
Jen Yang
Greenhorn

Joined: Jul 07, 2003
Posts: 11
Thanks. I checked it out. But it doesn't seem to be sufficient for my task. It can display a "table", but I can't make any interaction with the rows in the table. I'm totally new to this. So please bear with me. Can't I use an Applet which contains a JTable in a JSP page?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

You can use an applet in any page; has nothing to do with JSP.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Charles Hasegawa
Ranch Hand

Joined: May 22, 2003
Posts: 117
Yes, you could use an applet within your JSP page, but do you really want the applet to reload every time?
One thing you can try is :
http://j-wings.sourceforge.net/
I have not actually used this before, so I have no clue how well it works.
Jen Yang
Greenhorn

Joined: Jul 07, 2003
Posts: 11
Thanks for all your answers. So is Applet the only way to do this? What's the best way to display a JTable like table (with all the functionalities of JTable) in a JSP page??
Thanks a great great deal.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

The best way to handle this would be to change the J in jsp to an A.
Aside from that, j-wings, as mentioned before, is probably your best bet. But I don't think it really has ALL the functionallity of a SWING JTable. With your initial posts description of what you are trying to do, I don't know why you couldn't use a regular HTML Table with hyperlinks to the edit page you spoke of.


GenRocket - Experts at Building Test Data
Jen Yang
Greenhorn

Joined: Jul 07, 2003
Posts: 11
I'd really like to use a HTML table. But the table has to have scroll bars at both directions. IT has to look exactly like a Swing table.
Eddie Sheffield
Greenhorn

Joined: Oct 23, 2002
Posts: 21
Originally posted by Jen Yang:
I'd really like to use a HTML table. But the table has to have scroll bars at both directions. IT has to look exactly like a Swing table.

If you can otherwise get close enough to the look you require with an HTML table, you might be able to use an IFRAME to contain a page consisting of only the table. That should allow you to get the scroll bars you want. But if you REALLY have to use a JTable, then an applet is the only way to go.
Either way (IFRAME or applet) you're going to have to watch out for browser compatability problems, so make sure you consider what browser(s) your intended audience may be using.
HTH!


"When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon. You just have to outrun the halfling."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to put Swing components in a JSP page?