如何从django模板加载java小程序 [英] How to load java applet from django template

查看:26
本文介绍了如何从django模板加载java小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从静态 applet.html 文件调用它时,我的小程序运行文件,如下所示:

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>

但是如何在 django 模板中放置相同的行呢?我应该把 .jar 和 .java 文件放在哪里?我还注意到它在查找文件时将 .class 附加到 PApplet 并向我发送了 404 错误.

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.

推荐答案

您应该使用您的 jar 文件作为静态媒体文件,例如通过 MEDIA_URL 的图像或 CSS 文件.

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

将applet.jar放在media目录下,然后使用

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>

这篇关于如何从django模板加载java小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆