Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How to put Swing components in a JSP page?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use an applet in any page; has nothing to do with JSP.
hth,
bear
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
reply
    Bookmark Topic Watch Topic
  • New Topic