File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to put Swing components in a JSP page?

 
Jen Yang
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use an applet in any page; has nothing to do with JSP.
hth,
bear
 
Charles Hasegawa
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jen Yang
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic