-
FEATURED COMPONENTS
First time here? Check out the FAQ!
hi there... I have a homework to create simple web application that can communicate with serial or usb port. I know, this can be handled by using applet. Can somebody teach me how to do step by step thanks in advance
It is a homework so you are supposed to do that by yourself. We can provide you guidance. Here are the steps that you need to follow
Try implementing it yourself first and if you run into any problems (which I'm sure you will) come back to this forum and post your codes and error messages.
hello again. I did try to embedded this applet like the documentation, it did well but no applet show. I get applet from https://code.google.com/p/java-simple-serial-connector/wiki/jSSC_Terminal (jSSC terminal) and follow document. The zul file like this
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal">
<applet codebase="http://java-simple-serial-connector.googlecode.com/svn/trunk/terminal/launch.jnlp"
code="SerialPort.class"
xmlns:ca="client/attribute"
ca:separate_jvm="true" ca:draggable="true"
width="700" height="500" />
New Content Here!
</window>
</zk>
I don't know where I miss this code. please help me thanks
Hello Ashishd here is the code from their web https://code.google.com/p/java-simple-serial-connector/wiki/jSSC_Terminal (site)
<applet width="700" height="500">
<param name="jnlp_href" value="http://java-simple-serial-connector.googlecode.com/svn/trunk/terminal/launch.jnlp"/>
<param name="separate_jvm" value="true"/>
<param name="draggable" value="true"/>
</applet>
or
<script src="http://java.com/js/deployJava.js"></script>
<script>
var attributes = {
code: "applet.Main",
archive: "jSSC-Terminal.jar, lib/jssc.jar, lib/swing-layout-1.0.4.jar",
width: 700,
height: 500
};
var parameters = {separate_jvm:"true", draggable:"true", jnlp_href:"http://java-simple-serial-connector.googlecode.com/svn/trunk/terminal/launch.jnlp"};
var version = "1.5";
deployJava.runApplet(attributes, parameters, version);
</script>
Hello Ashishd here is the complete code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
<!--
body {
margin-left: 10px;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
}
-->
</style>
</head>
<body>
<script src="http://java.com/js/deployJava.js"></script>
<script>
var attributes = {
code: "applet.Main",
archive: "jSSC-Terminal.jar, lib/jssc.jar",
width: 700,
height: 500
};
var parameters = {separate_jvm:"true", draggable:"true", jnlp_href:"launch.jnlp"}; <!-- Applet Parameters -->
var version = "1.5"; <!-- Required Java Version -->
deployJava.runApplet(attributes, parameters, version);
</script>
<!-- Or use the following applet element to launch the applet using jnlp_href -->
<!--
<applet width="700" height="500">
<param name="jnlp_href" value="launch.jnlp"/>
</applet>
-->
</body>
</html>
This code is work perfectly
Hi ashishd
I very badly need any one of your help on ZK + Applet + Javascript. Here is the html version which works perfectly
Here is the html version link
As a first step i am trying to integrate the above into Existing ZK Application Here is the testing code
<?page title="Auto Generated index.zul"?>
<window xmlns:w="http://www.zkoss.org/2005/zk/client"
title="Hello World!!" border="normal" width="200px">
<applet name="CSSNLibJ" id="CSSNLibJ"
archive="xFunction.jar,CSSNLibJ.jar" code="lib.CSSNLibJ" width="10"
height="10">
</applet>
<script type="text/javascript">
<![CDATA[ function f_test()
{
var CSSNLibJ = '' + zk.Widget.$("$CSSNLibJ");
alert("CSSNLibJ "+ CSSNLibJ);
var foo = zk.Widget.$('$lbl');
foo.setValue("What's Up?");
alert("result before " + CSSNLibJ.GetScannerName());
var result = CSSNLibJ.InitScanLib("8NDANMAE6W8CZ5D5");
alert("result before ");
alert("result "+ result);
}
]]>
</script>
<label id="lbl" value="You are using: ${desktop.webApp.version}" />
<button label="Connect"
xmlns:w="http://www.zkoss.org/2005/zk/client" w:onClick="f_test();">
</button>
</window>
But it does not happen any thing after this line
var result = CSSNLibJ.InitScanLib("8NDANMAE6W8CZ5D5");
When i debug in IE, i am getting the following SCRIPT438: Object doesn't support property or method 'GetScannerName' Copy%20of%20index.zul, line 40 character 14
So it is clear that object does not initialized properly.
But it is working fine without ZK. So please help me
Just for Testing, i included that. Now i have removed. But still same problem. Look at the answer section for more detail
Senthilchettyin ( 2013-07-30 11:36:33 +0800 )edit<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="<a href=" http:="" www.w3.org="" 1999="" xhtml"="">http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Expires" content="-1"/> <title>Auto Generated index.zul</title>
<link rel="stylesheet" type="text/css" href="/ScanDemo/zkau/web/c928039/zul/css/zk.wcs;jsessionid=581AB4506214EE742983A447A625A561"/>
<script type="text/javascript" src="/ScanDemo/zkau/web/c928039/js/zk.wpd;jsessionid=581AB4506214EE742983A447A625A561" charset="UTF-8"></script> <script type="text/javascript" src="/ScanDemo/zkau/web/c928039/js/zul.lang.wpd;jsessionid=581AB4506214EE742983A447A625A561" charset="UTF-8"></script> <script type="text/javascript" src="/ScanDemo/zkau/web/c928039/js/zuljsp.js;jsessionid=581AB4506214EE742983A447A625A561" charset="UTF-8"></script> <script type="text/javascript" src="/ScanDemo/js/IdErrorDescription.js;jsessionid=581AB4506214EE742983A447A625A561" charset="UTF-8"></script> <script type="text/javascript" src="/ScanDemo/js/ScannerErrorDescription.js;jsessionid=581AB4506214EE742983A447A625A561" charset="UTF-8"></script> <script type="text/javascript" src="/ScanDemo/js/SDKLicenseKey.js;jsessionid=581AB4506214EE742983A447A625A561" charset="UTF-8"></script> </head> <body>Sorry, JavaScript must be enabled.
Change your browser options, then try again.
</body> </html>
Error as follows Refresh the page to see messages that may have occurred before the F12 tools were opened. SCRIPT438: Object doesn't support property or method 'GetScannerName' Copy%20of%20index.zul, line 41 character 14
Hi ashish
I think i am able to find out where is the problem is
Again look at this file. This file is pure HTML + Javascript
Now i am trying to convert the above file into ZK + Javascript. First problem i found that is, i cannot use document.getElementByID as per this link
Then i found the other way is zk.Widget.$("$CSSNLibJ"). But it is very sad, it perfectly works fine for components like Label, button etc. But it gives problem for ZK Applet. I saw in the zk forum, that applet tag already having some issues.
Then finally i removed all the Code, and just open HTML tag and put all the code as per the above file. Wow, it works perfectly. So i can conclude that some problem in ZK Applet tag, because same applet tag inside the html tag is working fine.
Now i have two options, one is , as i need to go with html tag, but really dont know how to read the HTML Component values in MVC or MVVM java class.
Second choice, still i need to try using ZK Component + Javascript.
@Senthil,
Make sure the older JS is not cached
What is the return value of zk.Widget.$("$CSSNLibJ")
? Try console.log()
or zk.log()
to print it. It should return you JS widget instance for ZK Applet component.
However from scan.html I suspect what you really need is the actual html applet element so you should do the following
var CSSNLibJ = zk.Widget.$("$CSSNLibJ").$n();
Refer to Widget $n() function here
Yes. i need the actual applet object. Let me try again
Senthilchettyin ( 2013-07-31 04:33:05 +0800 )editAsked: 2013-07-04 09:23:28 +0800
Seen: 101 times
Last updated: Jul 31 '13
Do not update to ZK Studio 2.0
Catch Server 503 Error - Or Catch Stale Page
how to save spreadsheet data into postgres database?
One controller file with multiple zul file
Why am I getting authentication error for ZK studio activation?
How can i make Tomcat (with virtual hosts) to parse the zul page in subfolders?