How to Open Applet with JFrames on HTML page load

Im a newbie in Java. I have a java applet with JFrames on it. it is running on Tomcat. I want to open it on a load. I can run it using a button and the button will post on the servlet and the servlet will call the applet class and call the init() method. Also do I need to export my applet class to .jar instead of using its java(.class) file?

Should I call it like this on HTML?

< applet codebase="" code="" archive="" width="800" height="500"> 
</applet>

what to put in the codebase? code? archive?

Thanks in advance!

Answers


I created an Upload File functionality in my system by using JFrames. My Problem is it opens on the server and I need it to open in the client side.

Easy done. Launch the frame from a link using Java Web Start.

Is it more easy to use Java Web Start than creating an applet?

Hell yes. (I was just going to reply 'yes' but felt that did not really cover the emphatic nature of my conviction on the matter.)

..is Java Web Start Application different in Java Web Application? because my JFrames is called and processed by my Servlets in a Java Application. I have an existing Web Application (it's a serial number tracking system) and I am adding an upload file to database functionality to it.

The servlet is part of the web-app. The desktop client is the JFrame - launched using Java Web Start from a link in the web app. The client side desktop app. can consume services of the web app. (e.g. show data obtained from it) or access other public APIs of the web app. (e.g. to search, make an order, save an edited resource..).

..is it posible for me to launch a JFileChooser from my JFrame?

Yes. If the app. is digitally signed, and the launch file requests/is granted all-permissions.

Alternately, use the File Services of the JNLP API. But they do not use the standard JFileChooser. More importantly, they return a FileContents object(s) rather than File.


I hope this link will help to start.

Also do I need to export my applet class to .jar instead of using its java(.class) file?

Yes, you do.

the servlet will call the applet class and call the init() method

No, it won't. Your applet jar will be downloaded on your client machine and then java plugin in your web browser will manage it's lifesycle.


Need Your Help

JSP Pagination using jQuery

jsp pagination

I am setting the results as a List in the request parameter and I created a results page in JSP which displays all the results in same page.

Summing over first 2D of 3D matrix

arrays matlab matrix

Suppose I have a 3D matrix A of size (1,2,3). Something like