views:

185

answers:

2

My applet runs file when I call it from a static applet.html file, like this:

<applet archive="applet.jar" code="com.xxx.yyy.PApplet" 
    width="100" height="20"></applet>

But how do I put the same line in a django template? And where should I put the .jar and .java files? I also noticed that it appends .class to the PApplet while looking for the file and sends me a 404 error.

I tried googling and looked into documentation, but couldn't find this issue addressed anywhere before. Thanks for your help.

A: 

You should use your jar file as a static media file like an image ou CSS file via MEDIA_URL.

Put applet.jar in the media directory, then use

<applet archive="{{ MEDIA_URL }}applet.jar" code="com.xxx.yyy.PApplet" 
width="100" height="20"></applet>
Desintegr
Yes, I did so like this:<applet archive="{{ MEDIA_URL }}applet.jar" code="{{ MEDIA_URL}}com.xxx.yyy.PApplet" width="100" height="20"></applet>And put the necessary files in the media folder. But django appends a .class to PApplet and sends a 404 Error. I'm stumped at that stage.
ninja123
The `code` value is related to the jar file content, not the directory where is the jar file.
Desintegr
Oh... thats useful to know! Now it works!!! Thanks guys. But I was wondering if there is a way of communicating with java applets in my view itself rather than in template?
ninja123
A: 

This has nothing whatsoever to do with Django.

A Java applet for client-side use needs to be served in exactly the same way as any other static assets - CSS, Javascript, etc. So you'd put it wherever those files are, configure Apache or whatever to serve from there, and reference that directory in your applet tag.

Daniel Roseman