简体   繁体   English

GlassFish 3.0.1服务器上的Java小程序

[英]Java applet on GlassFish 3.0.1 server

I have developed an applet and I am using a JSP to upload it. 我已经开发了一个applet,并且正在使用JSP上载它。 I have worked it using Netbeans 6.9. 我已经使用Netbeans 6.9进行了工作。 The applet works fine without JSP. 没有JSP的小程序可以正常工作。 When I run JSP on Glassfish server, applet does not run. 当我在Glassfish服务器上运行JSP时,applet无法运行。

My applet takes 43 seconds to do processing and get displayed, I think this may be the problem. 我的小程序需要43秒钟进行处理并显示出来,我认为这可能是问题所在。


When I run the same JSP with the same applet but with slight modification, applet runs correctly with JSP. 当我使用相同的applet运行相同的JSP但稍作修改后,applet可以在JSP中正确运行。 Modification is that I comment out a function call (called from init() method) which is responsible for large execution time. 修改之处在于,我注释掉了一个函数调用(从init()方法调用),该函数调用导致执行时间较长。 The long running method reads three files and generates the output in the choice buttons, ie generates the choices. 长时间运行的方法读取三个文件,并在选择按钮中生成输出,即生成选择。

But I need that function in my applet, that is very important function. 但是我的applet中需要该功能,这是非常重要的功能。

Every catch statement has a printstacktrace() method call in it. 每个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();
}

Modification is that I comment out a function call (called from init() method) which is responsible for large execution time. 修改之处在于,我注释掉了一个函数调用(从init()方法调用),该函数调用导致执行时间较长。

It seems it will be necessary to refactor that method call to the start() method, or do it in a separate Thread (eg using a SwingWorker ). 似乎有必要将方法调用重构为start()方法,或在单独的Thread进行重构(例如,使用SwingWorker )。


The long running method reads three files and generates the output in the choice buttons, ie 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() ). init()方法中添加选择框,但在start()方法中填充选择框(如果尚未完成-每次从最小化还原浏览器时以及在init()之后直接调用start方法)。

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

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