This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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!!
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?
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.
Joined: Jul 07, 2003
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.
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.
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."