简体   繁体   English

Java Swing和HTML

[英]Java Swing and HTML

I am currently trying to upload Java Table(JTable) onto a JSP page. 我目前正在尝试将Java Table(JTable)上传到JSP页面上。 Can anybody give me suggestions on how to achieve this? 有人可以给我建议如何实现这一目标吗? I currently using this for my JSP page. 我目前在我的JSP页面上使用它。

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="javaPackage.Table" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
   <html>
      <head>
          <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
          <title>Telus Database</title>
      </head>

      <body>
          <div>
<%
Table table = new Table("tableName");

%>
          </div>
      </body>
   </html>

And I use JFrame inside of the Table class, but when I enter this webpage, it causes the web to make a popup of the Table and I don't want that. 而且我在Table类中使用了JFrame,但是当我进入此网页时,它使网络弹出Table的弹出窗口,而我不希望这样做。 I want the table to be on the page. 我希望表格在页面上。 Any suggestions will be greatly appreciated. 任何建议将不胜感激。 Thank you in advance for your help. 预先感谢您的帮助。 NOTE: I have to use Java Swing since the previous writer used it to upload the datas from the mysql database with JDBC and tomcat apache. 注意:我必须使用Java Swing,因为以前的作者使用Java Swing使用JDBC和tomcat apache从mysql数据库上载数据。

I'd still try to render this into an HTML table, but if you must use swing: 我仍然尝试将其呈现到HTML表中,但是如果必须使用swing:

  1. try writing an applet , or 尝试编写一个applet ,或者
  2. Render the swing components on the server . 在服务器上渲染Swing组件 The gist of it is that you render the swing component to an image on the server (so, off-screen), and then send the rendered image to the page. 其要点是您将swing组件渲染到服务器上的图像(因此,不在屏幕上),然后将渲染的图像发送到页面。 It's an interesting trick, but the user won't be able to interact with the JTable. 这是一个有趣的技巧,但是用户将无法与JTable进行交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM