I'm new to Struts 2 . Now developing a gallery page in a web project. In that i have to show images/audio/video files in a pop up without page loading. I succeeded that in Images & Video files working fine, but not Audio files. My struts action as follows.
<action name="download" class="com.mkyong.common.action.DownloadAction">
<result name="success" type="stream">
<param name="contentType">application/octet-stream</param>
<param name="inputName">fileInputStream</param>
<param name="bufferSize">256</param>
</result>
</action>
And my class file is
try {
fileInputStream = new FileInputStream(new File("E:\\ESS_GALLERY\\2451252452\\Gallery\\Audios\\audio_2.wav"));
} catch (Exception e) {
e.printStackTrace();
}
And jsp(HTML) code is
<object id='tempAud1' name="emQTPlayer" height="45px" width="120px"
style="behavior: url(#BinaryBehaviorID)"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B">
<param name="autoplay" value="false" />
<param name="src"
value="<s:property value="mediaAud[0].fileLocation"/>" />
<param name="controller" value="true" />
<param name="type" value="video/quicktime" />
<param name="align" value="bottom" />
<param name="border" value="0" />
<%--<param name="wmode" value="transparent">--%>
<param name="showcontrols" value="true">
<embed id='tempAud2' name="emQTPlayer" type="video/quicktime"
autoplay="false" height="45px" width="120px" align="top" border="0"
controller="true" postdomevents="true"
pluginspage="http://www.apple.com/quicktime/download/"
showcontrols="true" src='' />
</object>
.
In that i'll set the src at the onclick event...
By changing the content type parameter as follows..
<action name="download" class="com.mkyong.common.action.DownloadAction">
<result name="success" type="stream">
<param name="contentType">audio/mpeg</param>
<param name="inputName">fileInputStream</param>
<param name="bufferSize">256</param>
</result>
</action>
This works fine for audio files....
Is it normal that you are not providing the source to <embed> object ?
Try changing it to
<embed id='tempAud2' name="emQTPlayer" type="video/quicktime"
autoplay="false" height="45px" width="120px" align="top" border="0"
controller="true" postdomevents="true"
pluginspage="http://www.apple.com/quicktime/download/"
showcontrols="true" src='<s:property value="mediaAud[0].fileLocation"/>' />
Related
I Have some action classes that return JSON results for my Ajax call,
<action name="sampleAction" class="com.sample.SampleAction">
<interceptor-ref name="defaultSecurityStack" />
<result name="success" type="json">
<param name="noCache">true</param>
<param name="excludeNullProperties">true</param>
<param name="root">result</param>
</result>
</action>
Is it possible to prevent users from accessing that action directly when typed in the url? Thank you so much!
does anyone tried JUpload java applet with codeigniter?
this is my views
<h1 align="center">JUpload PHP Sample Page</h1>
<div align="center">
<APPLET
CODE="wjhk.jupload2.JUploadApplet"
NAME="JUpload"
ARCHIVE="../../../../jar/wjhk.jupload.jar"
WIDTH="640"
HEIGHT="300"
MAYSCRIPT="true"
ALT="The java pugin must be installed.">
<param name="postURL" value="ftp://username:password#host:21/testupload" />
<param name="ftpCreateDirectoryStructure" value="true" />
<param name="showLogWindow" value="onError">
<param name="afterUploadURL" value="javascript:alert('Upload done');">
<param name="debugLevel" value="99">
<param name="showStatusBar" value="True">
<param name="maxFileSize" value="25000000">
<param name="maxChunkSize" value="25000000">
<param name="httpUploadParameterType" value="iteration">
<param name="nbFilesPerRequest" value="100">
<param name="stringUploadSuccess" value="SUCCESS">
<param name="stringUploadWarning" value="WARNING">
<param name="stringUploadError" value="ERROR">
Java 1.5 or higher plugin required.
</APPLET>
</div>
but I have no luck to post my ftp, the error says:
java.lang.SecurityException: java.lang.SecurityException in JUploadPanelImpl.doStartUpload()
before I try with codeigniter, I try with pure PHP and it worked. Please help me how to combine this JUpload with codeigniter
Thank you
First of all, check for bad credentials (username,password).
If that's not the cause then my guess would be that your server doesn't allow remote access to ftp.
Configure your server for proper access.
I have a scanner applet with size about 2m and takes too long to load and when I enable console I found this error many times:
Cache entry not found
[url: 10.32.0.19/digital/script/scanner.jar, version: 1.0.0.0]
Then I search and find some questions that not solve my problem.
This is my html:
<object classid="java:com.openkm.applet.Scanner"
type="application/x-java-applet"
archive="scanner.jar"
codebase="10.32.0.19/script/"
height="3" width="5"
name="applet">
<param name="archive" value= "scanner.jar"/>
<PARAM NAME="cache_archive" VALUE="scanner.jar">
<PARAM NAME="cache_version" VALUE="1.0.0.0">
<param name="mayscript" value="true" />
<param name="scriptable" value="true" />
<PARAM name="codebase" value="10.32.0.19/script/">
<param name="path" value="10.32.0.19/scan/responder"/>
<param name="token" value="<?php echo $this->sid ?>"/>
<param name="cotag" value="1">
<param name="action" value="entery" />
<param name="lang" value="en_EN" />
<center>
<img src="/path/to/images/chemwriter_logo.png" />
<p><strong>ChemWriter content requires Java 1.4.2 or higher, which your browser does not appear to have.</strong></p>
<p>Get the latest Java Plug-in.</p>
</center>
</object>
Cache setting in Java preferences is enabled.
I try with Mozilla Firefox 15 on Windows XP.
How to solve this error?
This is probably a server configuration issue.
Q: Do you have any control over the server?
Q: Can you modify the "mime-type" of ".jar" files to application/java-archive?
There is no "probable" here (unless you did not provide correct logs and setup details) - it is sever side problem. Server setup or applet build seems to be incorrect looking for cached version in (what looks like) incorrect and definitely unconfigured directory.
As far as I can see from the documentation, <applet> is deprecated, and the <object> tag is the preferred method for launching an applet now. But I can't find decent documentation, or even a tutorial on how to use the object tag to launch an applet.
I did see the following question which shows how in javascript but I would prefer to use a tag
launch applet from web page
I need to know how to specify the java engine, how to specify a jar file, where it's stored, and how to specify the class that is executed.
Here's what i have at the moment (but does not work)
<object
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="800" height="600" data="pi.jar">
<param name="code" value="PiLauncher.class"/>
</object>
the claim was in the Oracle 1.5 docs that this classid specifies "the current java engine" but this is completely opaque to me. They also had examples requesting a specific version.
Even if this is true, how do I:
specify the jar file
specify the class (is this correct above)
specify the directory where the code is (is codebase still valid?)
First of all, the syntax is not the same for firefox and IE:
Firefox:
<object classid="clsid:CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA" id="appletId" name="appletName" width="400" height="300">
<param name="code" value="com.myPackage.Applet" />
<param name="codebase" value="../resources/applet/"/>
<param name="ARCHIVE" value="myApplet.jar" />
<param name="cache_archive" value="myApplet.jar" />
<param name="type" value="application/x-java-applet" />
<param name="cache_option" value="plugin" />
<param name="mayscript" value="true" />
// you can set optional parameters here
</object>
IE:
<object width="400" height="300" classid="java:com.myPackage.Applet.class" codebase="../resources/applet/" name="appletName" id="appletId">
<param name="archive" value="myApplet.jar" />
<param name="type" value="application/x-java-applet" />
<param name="cache_option" value="plugin" />
<param name="mayscript" value="true" />
// you can set optional parameters here
</object>
Here is a good link: http://docs.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/using_tags.html#object
Well, this is my trouble:
I have an applet that controlls a magnetic stripe reader and I need to call a JS function when the MSR reads a card to catch the data and submit in a form.
The problem is the applet cannot call JS functions when it is called from a remote PC o server, but locally all the code works fine.
I supposed that is a issue of privileges on the browser.
This is my HTML code:
<html>
<head>
<title>Applet Prueba</title>
<script src="jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#AppletPrueba")[0].apOpenPrinter();
$("#AppletPrueba")[0].apActivaMSR();
});
function print()
{
$("#AppletPrueba")[0].apPrintCreditInfo();
}
function setTxtBox(texto)
{
$("#txtBox").val(texto);
}
</script>
</head>
<body>
<object id = "AppletPrueba"
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width = "1"
height = "1">
<param name="code" value="applet.AppletJPos.class"/>
<param name="archive" value="SAppletJPos.jar,Sjpos11021.jar,Sjpos191.jar,SNCRJavaPOS39.jar,SNCRJavaPOSClasses.jar,Sxerces.jar"/>
<param name="scriptable" value="true"/>
<param name="mayscript" value="true"/>
<param name="param0" value="1"/>
<param name="param1" value="Tienda"/>
<param name="param2" value="XXX"/>
<param name="param3" value="RUBEN C. FLORES GARNETT"/>
<param name="param4" value="09 de Marzo de 2012"/>
<param name="param5" value="0.00"/>
<param name="param6" value="0.00"/>
<param name="param7" value="0.00"/>
<param name="param8" value="0.00"/>
<param name="param9" value="0.00"/>
<param name="param10" value="0.00"/>
<param name="param11" value="0"/>
<param name="param12" value="0.00"/>
<param name="param13" value="0.00"/>
<param name="param14" value="0.00"/>
<param name="param15" value="0.00"/>
<param name="param16" value="0.00"/>
<param name="param17" value="0.00"/>
<param name="param18" value="0.00"/>
<param name="param19" value="0.00"/>
<param name="param20" value="0.00"/>
<param name="param21" value="0.00"/>
<param name="param22" value="0.00"/>
<param name="param23" value="0.00"/>
<param name="param24" value="1"/>
</object>
<input type="button" value="Imprime Ticket" onclick="print()" />
<br/>
<input type="text" value="" id="txtBox" />
</body>
And that is the way the applet call the JS function:
AppletContext appletCtxt = getAppletContext();
...
appletCtxt.showDocument(new URL("javascript: setTxtBox('" + editedCardId[0] + "')"));
I really hope somebody can help me.
(I'm sorry if my english is bad :P)
The Oracle tutorial on the matter would probably be useful.
Invoking JavaScript Code From an Applet
The netscape.javascript.JSObject class enables Java applets to
retrieve a reference to JavaScript objects and interact with the web
page.