GlassFish 3.0.1 服务器上的 Java 小程序

发布于 2025-01-01 01:04:38 字数 749 浏览 1 评论 0原文

我开发了一个小程序,我正在使用JSP来上传它。我已经使用 Netbeans 6.9 进行了工作。小程序无需 JSP 即可正常工作。当我在 Glassfish 服务器上运行 JSP 时,小程序不运行。

我的小程序需要 43 秒来进行处理并显示,我认为这可能是问题所在。


当我使用相同的小程序运行相同的 JSP 但稍加修改时,小程序可以与 JSP 一起正确运行。修改是我注释掉了一个函数调用(从 init() 方法调用),该调用负责较长的执行时间。长时间运行的方法读取三个文件并在选择按钮中生成输出,即生成选择。

但我的小程序中需要该功能,这是非常重要的功能。

每个 catch 语句中都有一个 printstacktrace() 方法调用。

public void start(){
   initialise_maps();
}


public void init() {
    try {
        java.awt.EventQueue.invokeAndWait(new Runnable()
        {
            public void run() {
                initComponents();
            }
        });
    } catch (Exception ex)
    {
        ex.printStackTrace();
    }
 //   initialise_maps();
}

I have developed an applet and I am using a JSP to upload it. I have worked it using Netbeans 6.9. The applet works fine without JSP. When I run JSP on Glassfish server, applet does not run.

My applet takes 43 seconds to do processing and get displayed, I think this may be the problem.


When I run the same JSP with the same applet but with slight modification, applet runs correctly with JSP. Modification is that I comment out a function call (called from init() method) which is responsible for large execution time. The long running method reads three files and generates the output in the choice buttons, i.e. generates the choices.

But I need that function in my applet, that is very important function.

Every catch statement has a printstacktrace() method call in it.

public void start(){
   initialise_maps();
}


public void init() {
    try {
        java.awt.EventQueue.invokeAndWait(new Runnable()
        {
            public void run() {
                initComponents();
            }
        });
    } catch (Exception ex)
    {
        ex.printStackTrace();
    }
 //   initialise_maps();
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不醒的梦 2025-01-08 01:04:38

修改是我注释掉了一个函数调用(从 init() 方法调用),该调用负责较长的执行时间。

看来有必要将该方法调用重构为 start() 方法,或者在单独的 Thread 中执行此操作(例如使用 SwingWorker)。


长时间运行的方法读取三个文件并在选择按钮中生成输出,即生成选择。

init() 方法中添加选择框,但在 start() 方法中填充它们(如果尚未完成 - 每次浏览器从最小化状态恢复时都会调用 start 方法,以及直接在 init() 之后调用)。

Modification is that I comment out a function call (called from init() method) which is responsible for large execution time.

It seems it will be necessary to refactor that method call to the start() method, or do it in a separate Thread (e.g. using a SwingWorker).


The long running method reads three files and generates the output in the choice buttons, i.e. generates the choices.

Add the choice boxes in the init() method, but populate them in the start() method (if not already done - the start method is called every time the browser is restored from minimized, as well as directly after init()).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文