#set($userName = "$!{context.getUser()}")
#set($docFullName = "$!{doc.getFullName()}")
#set($docParentName = "$!{doc.getParent()}")
#set($serverIP = "${request.getServerName()}")
#set($appPath = "${request.getContextPath()}")
#set($serverPort = "${request.getServerPort()}")
<div class="imageuploadform" id="imageuploadcontainer">
<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<object
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase = "http://java.sun.com/update/1.6.0/jinstall-6u18-windows-i586.cab#Version=6,0,0,7"
NAME = "imageuploadapplet"
WIDTH = "800px"
HEIGHT = "650px">
<PARAM NAME = CODE VALUE = "com.xx.imageupload.ImageFrame" >
<PARAM NAME = CODEBASE VALUE = "/iKnow/imageupload" >
<PARAM NAME = ARCHIVE VALUE = "/iKnow/imageupload/imageupload.jar" >
<PARAM NAME = NAME VALUE = "imageuploadapplet" >
<param name = "type" value = "application/x-java-applet;version=1.6">
<param name = "scriptable" value = "false">
<param name = "username" value="$userName">
<param name="docfullname" value="$docFullName">
<param name="password" value="123456">
<param name="docparentname" value="$docParentName">
<param name="rpcurl" value="http://$serverIP:$serverPort$appPath/xmlrpc">
<comment>
<embed
type = "application/x-java-applet;version=1.6" \
CODE = "com.huawei.imageupload.ImageFrame" \
JAVA_CODEBASE = "/iKnow/imageupload" \
ARCHIVE = "/iKnow/imageupload/imageupload.jar" \
NAME = "imageuploadapplet"
scriptable = false
pluginspage = "http://java.sun.com/products/plugin/index.html#download">
username = "$userName"
password = "123456"
docfullname = "$docFullName"
docparentname = "$docParentName"
rpcurl = "http://$serverIP:$serverPort$appPath/xmlrpc";
<noembed>
</noembed>
</embed>
</comment>
</object>
<!--
<APPLET CODE = "com.huawei.imageupload.ImageFrame" JAVA_CODEBASE = "/iKnow/imageupload" ARCHIVE = "/iKnow/imageupload/imageupload.jar" NAME = "imageuploadapplet">
</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
</div>
后台在继承JApplet的主类init方法中可以用this.getParameter("username");取到参数值。
用object标签暂时不知道如何在js中调用applet中的方法,用applet标签可以,但是applet标签当客户端没有安装jdk时不会提示下载安装。
//设置图片属性到applet(applet标签形式)
var appletObj = document.imageuploadapplet;
//移除上次显示的图像
appletObj.removePicture();
var userName = "$userName";
if(userName.indexOf(".")!=-1){
userName = userName.substring(userName.indexOf(".")+1);
}
var docFullName = "$docFullName";
var docParentName = "$docParentName";
var serverRpcUrl = "http://$serverIP:$serverPort$appPath/xmlrpc";
appletObj.setImageProperty("userName",userName);
appletObj.setImageProperty("docFullName",docFullName);
appletObj.setImageProperty("password","123456");
appletObj.setImageProperty("docParentName",docParentName);
appletObj.setImageProperty("rpcUrl",serverRpcUrl);