How to terminate java process from javascript
How can we terminate architecture flow in between of process ? suppose once we have submitted form to insert the record but we want to terminate the process started at java side before inserting record in database, how is it possible through javascript?
The thing is I wish to terminate the current java process when user clicks on any other action on jsp page. I am calling these process from ajax. when user click any other action on the page I abort the current XMLHttpRequest but only the request on the page stop but the process on java side don't stop exetuting
Similar Messages
-
How to call java program from javascript
Hi,
I have an java program which will transform one xml to another xml using XSLT.
I want to call this java program from Javascript? Is this possible? Please suggest me.
Thanks,
Gopalis it not possible?
do i have to refresh the page and read in the values like...
<%
String ename = request.getParameter( "EmployeeName");
session.setAttribute( "ename", ename);
%>and then call the class from here?
looking around ive come across ajax but i dont know how to use it and what you need to install and if its compatable with tomcat and jsp?
is ajax better or not really worth it?
i have anything up to 100 fields that need saving at one save click -
How to call java classes from javascript?
i have a button which calls javascript i need to access a class to update the values in the database.. how do you call the java code from within the javascript?
the class is stored under tomcats classes directory and is accessed:
com.Database.Employee
the method is called : UpdateEmployeeDetails
the button
<input type="button" value="Save" onclick="submitForm('save')" />the javascript
<script language="javascript">
function submitForm(process){
document.myForm.action="update.jsp";
document.myForm.submit();
</script>is it not possible?
do i have to refresh the page and read in the values like...
<%
String ename = request.getParameter( "EmployeeName");
session.setAttribute( "ename", ename);
%>and then call the class from here?
looking around ive come across ajax but i dont know how to use it and what you need to install and if its compatable with tomcat and jsp?
is ajax better or not really worth it?
i have anything up to 100 fields that need saving at one save click -
ANSWER: HOW TO DETECT Java Plugin from JavaScript
I created a new topic because the questions about
how to detect Java Plugin in browsers are scattered
thoughout this forum.
Basically you need to employ two approaches for IE and NS.
In IE you need to try to instantiate a small applet
(not your production applet) in order to see if browser
can do it. if the browser can do it, you can make a
call applet from JavaScript in order to find version of
JRE (as well as a host of other things).
In NS you can write a simple JavaScript which will
interrogate the browser for all plugins installed. Then
ypu can make a desicion whether to pass execution to
the next(or generated) page which hosts your applet,
or ask the user to download/install a plugin.
I ecourage everybody to host a plugin on your site
rather leave default link to it which is generated by
html converter.
In order to run sample,
Prerequisites:
Java Plugin 1.3.
If you have a different version of plugin,
substitute hardcoded plugin version in JavaScript for
value that you have.
1. compile java file
2. put class file in the same directory with html file
3. load html file into the browser.
4. press "Check Java Plugin.." button
5. see it work
6. examine code
7. uninstall plugin
8. repeat steps 1 - 4
9. see it work
10. install plugin.
Sample code follows:
**********************HTML FILE BEGIN***********
<HTML>
<HEAD>
<!-- Generated by Kawa IDE -->
<TITLE>Detect Java Runtime</TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
var browsername;
function doNetscape()
for (i=0; i < navigator.plugins.length; i++)
for (j = 0; j < navigator.plugins.length; j++)
if(navigator.plugins[i][j].type == "application/x-java-applet;version=1.3")
alert("You are running Netscape with Java Plugin 1.3.0 - OK");
return;
alert("You are running Netscape\nPlease, install Java Runtime Environment 1.3.0");
function doMicrosoft()
var applet = document.myApplet;
if(applet == null)
alert("You are running Microsoft Browser.\nPlease, install Java Runtime Environment 1.3.0");
return;
var version = applet.getJavaVersion();
if(version == "1.3.0")
alert("You are running IE, Java Plugin 1.3.0 installed - OK");
else
alert("You are running IE, other plugin installed - mybe OK if later that 1.3.0\nYour version: " + version);
function getJava()
var applet = document.myApplet;
if(applet == null)
alert("Please, install Java Runtime Environment");
return;
alert("JRE Version: " + document.myApplet.getJavaVersion());
function checkJavaPlugin()
browsername = navigator.appName;
if(browsername.indexOf("Netscape")!= -1)
browsername="NS";
doNetscape();
else
if(browsername.indexOf("Microsoft")!=-1)
browsername="MSIE";
doMicrosoft();
else
browsername="N/A";
alert("Unknown browser: " + browsername);
</SCRIPT>
<body>
<Strong>Check Java Plugin</strong>
<OBJECT id="myApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 1
HEIGHT = 1 >
<PARAM NAME = CODE VALUE = "DetectPluginApplet.class" >
<PARAM NAME="scriptable" VALUE="true" >
<embed type="application/x-java-applet;version=1.3"
code = DetectPluginApplet width = 2 height = 2 MAYSCRIPT = "true" >
</embed>
</EMBED>
</object>
<FORM>
<INPUT TYPE="button" value="Get Plugin Version in IE" onClick="getJava()">
<INPUT TYPE="button" value="Check Java Plugin in NS and IE" onClick="javascript:checkJavaPlugin()">
</FORM>
</BODY>
</HTML>
**********************HTML FILE END***********
***************APPLET FILE BEGIN***********
import java.awt.*;
public class DetectPluginApplet extends java.applet.Applet
public void init()
add(new Label("DetectPluginApplet"));
public String getJavaVersion()
return System.getProperty("java.version");
**************APPLLET FILE END************Try following java script, it works on new browsers (NS 4+, IE5+). For IE you have to enable 'ActiveX objects creation' in security options.
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav4up = (is_nav && (is_major >= 4));
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0") !=-1));
var is_ie5up = (is_ie && (is_major == 4)
&& ( (agt.indexOf("msie 5.0")!=-1)
|| (agt.indexOf("msie 5.5")!=-1)
|| (agt.indexOf("msie 6.0")!=-1) ) );
var pluginDetected = false;
var activeXDisabled = false;
// we can check for plugin existence only when browser is 'is_ie5up' or 'is_nav4up'
if(is_nav4up) {
// Refresh 'navigator.plugins' to get newly installed plugins.
// Use 'navigator.plugins.refresh(false)' to refresh plugins
// without refreshing open documents (browser windows)
if(navigator.plugins) {
navigator.plugins.refresh(false);
// check for Java plugin in installed plugins
if(navigator.mimeTypes) {
for (i=0; i < navigator.mimeTypes.length; i++) {
if( (navigator.mimeTypes[ i].type != null)
&& (navigator.mimeTypes[ i].type.indexOf(
"application/x-java-applet;jpi-version=1.3") != -1) ) {
pluginDetected = true;
break;
} else if (is_ie5up) {
var javaVersion;
var shell;
try {
// Create WSH(WindowsScriptHost) shell, available on Windows only
shell = new ActiveXObject("WScript.Shell");
if (shell != null) {
// Read JRE version from Window Registry
try {
javaVersion = shell.regRead("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment\\CurrentVersion");
} catch(e) {
// handle exceptions raised by 'shell.regRead(...)' here
// so that the outer try-catch block would receive only
// exceptions raised by 'shell = new ActiveXObject(...)'
} catch(e) {
// Creating ActiveX controls thru script is disabled
// in InternetExplorer security options
// To enable it:
// a. Go to the 'Tools --> Internet Options' menu
// b. Select the 'Security' tab
// c. Select zone (Internet/Intranet)
// d. Click the 'Custom Level..' button which will display the
// 'Security Settings' window.
// e. Enable the option 'Initialize and script ActiveX controls
// not marked as safe'
activeXDisabled = true;
// Check whether we got required (1.3+) Java Plugin
if ( (javaVersion != null) && (javaVersion.indexOf("1.3") != -1) ) {
pluginDetected = true;
if (pluginDetected) {
// show applet page
} else if (confirm("Java Plugin 1.3+ not found, Do you want to download it?")) {
// show install page
} else {
// show error page
} -
How to terminate an exe from Java
Hi Everyone
Can anyone let me know the code to how to terminate an exe from Java
I run an exe using
Runtime.getRuntime().exec(dialog); //where dialog is a string (pointing to an exe)
Now i need to kill this exe
How do i do this in java
Any help is highly appreciated
Thanks!getafix14 wrote:
I run an exe using Runtime.getRuntime().exec(dialog); //where dialog is a string (pointing to an exe)
Now i need to kill this exe
How do i do this in java
ejp wrote:
Process.destroy();
And don't forget to take a swig of magic potion first.
Winston -
How to invoke BPEL process from JAVA API
Hi Guys
Any idea if you can tell me how to invoke BPEL process from JAVA API ?
What to do in BPEL process manager to achieve that?
Regards
DeepakSee http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28981/invoke.htm#sthref1373 and the JavaDocs http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/toc.htm.
-
How to call java function in javascript
Hello Everyone,
Can anyone tell me solution that:
How to call java function in javascript?
Thanks,
VIDsYou can't since Java is running on the server and javascript is running in the browser long after the Java side of things has finished executing. Assuming you're not talking about an applet here.
But you can make calls back to the server through Ajax. All you need is something like a servlet on the receiving end which you can invoke through Ajax; from that point you can execute any Java code you want. -
Access Java object from Javascript
Hi
I'm trying to invoke a Java object from Javascript (scriptengine and all that).
I want to add scripting features to a GeneXus Java generated app... and I have very basic skills on java too. Sorry for that ;o).
This is the java code to pass "params" to the scriptengine:
engine.put("remoteHandle",remoteHandle);
engine.put("context", context); The remoteHandle (int) and context (com.genexus.ModelContext) pass trough all the gx-java generated programs.
This javascript works fine:
importClass(Packages.uftestjs);
new uftestjs(remoteHandle).execute( ) ;The remoteHandle conversion is ok (javascript-number to int). The context is optional.
But if I want to pass context:
importClass(Packages.uftestjs);
new uftestjs(remoteHandle, context).execute( ) ;Fails with this:
"javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: Java constructor for 'uftestjs' with arguments 'number,javax.script.SimpleScriptContext' not found."
Obviously, no conversion is possible with context (javax.script.SimpleScriptContext to com.genexus.ModelContext).
There is some way to reference de original context, by the object Id??? or something like that???
Thanks in advance for any replies!!!
Greetings from Chile. (I hope you can understand my english!)Hi
Well, since this topic is about java programming I think the place is right here.
(I use some tricks to embed java statements in genexus objects...)
I will try to get some help at Artech (GX) on how to build something... to get the conversion needed.
But they are not focussed on support this kind of questions.
Anyway, I want to know: do I can to reference an object by the objId?
I want to code something like this:
com.genexus.ModelContext context =
(com.genexus.ModelContex)getTheObjectFromTheJVM(theObjectId);(powered by google translator, ha!) -
How to call SOAP API from JavaScript
Hi,
I'm trying to call the SOAP API to get statistics about emails. Are there any examples on how to call the API from JavaScript?
Here is a link to my original question about using the REST API. REST API URL for email statistics
Thanks,
TimTim,
In order to consume a SOAP API I recommend you use something other than JavaScript.
Any platform can offer you a good SOAP client should be OK. (.Net, Java, php, Ruby, python).
I didn't see anyone successfully used javascript and consume the Eloqua SOAP API.
I know you can create a SOAP client in Java script but it will be too much work to handle the Eloqua response in some cases.
Regards,
Daniel -
How to call java program from ABAP
Hi Experts,
My requirement is to call java programs from ABAP. For that i have set up SAP JCO connection by using this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/739. [original link is broken] [original link is broken] [original link is broken] Connection gets sucessfully. After this how to call java program from ABAP as per our requirement. Please help me out.
Also i tried this way also.. but while executing the DOS Command line appear & disappear in few seconds. So couldnt see the JAVA output. Please help me out to call java programs in ABAP..
DATA:command TYPE string VALUE 'D:Javajdk1.6.0_20 injavac',
parameter TYPE string VALUE 'D:java MyFirstProgram'.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = command
parameter = parameter
OPERATION = 'OPEN'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
OTHERS = 8.
Thanks.This depends on the version of your Netweaver Java AS. If you are running 7.0, you will have to use the Jco framework. The Jco framework is deprecated since 7.1 though. If you want to build a RFC server in 7.1 or higher, it is adviced that you set it up through JRA.
Implement an RFC server in 7.0:
http://help.sap.com/saphelp_nw04/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
Implement an RFC server in 7.1 or higher:
http://help.sap.com/saphelp_nwce72/helpdata/en/43/fd063b1f497063e10000000a1553f6/frameset.htm -
How to load java class from jsp page?
hi all!
Does anyone know how to load java class from jsp page?
I try to load java class from jsp page.
Is it possible to load java class fom jsp page?
thanks and have a good day!What I mean is How to load/open java class file from jsp page?
I think we can open Applet from jsp page by using
<applet code=helloApplet.class width=100 height=100>
</applet>
but, how to open java class which is an application made by Frame?
thanks and have a good day -
How to call java method from workflow script?
Hi
I have a requirement of updating field value 'Document Status' based on review/approve of content from Workflow and hence need to update the version number. For that I need to call my java method from workflow during submit of review/approve condition. Please let me know how to call java method from workflow?
Is there any alternative better way to achive this requirement from workflow? Please suggest.
Thanks,
SarangOK. So, I think we can all conclude that you don't need to call any Java method, can't we? And, that wfUpdateMetadata is the command that will update your metadata.
Now, the question is what are its arguments. It has two - the first is the name of a custom metadata field to be updated (let's suppose that one field is called xMinorVersion, and the other xMajorVersion), the other is the new value, e.g. <$wfUpdateMetaData("xMinorVersion", "New value.")$>As for new value - do you insist on using strings? Since you want to increase the value, it would be more convenient to work with numbers. For instance, with integers you could go with <$wfUpdateMetaData("xMinorVersion", xMinorVersion + 1)$>With strings you will need to convert it to numbers and back to strings. Besides, what happens if you have more than 100 minor versions? (you mentioned you want to add 0.01, but that would finally increase the major version, wouldn't it?) So, I think these two numbers are independent (perhaps, with exception that increase on the major version set the minor version to .00).
If you want to present it, you can use profiles that will construct for you the representation 2.304 out of MajorVersion = 2, MinorVersion = 304
Solved? -
How to run java program from website?
Hello
I'd like to know how to run java program from my web page.
I'd like to push some button in this web page so java program that would be on my server
would pop-up. Can it be done automaticaly upon running this web site? (without any buttons - I just enter website and program pops up).
CheersI rather thought about RMI. But I could try servlets. So how it would look like?.
I would make http request in browser (enter address) and program would show up in its window?. And I would not have to change anything in my program?. This program would run then on both boxes?. One remotely and one not?.
But I would have to learn some basics, I've never worked with servlets. Could you suggest some good sites about it?. With ready examples so I could tweak them to my purpose.
Message was edited by:
macmacmac -
How to call Java API from BSP?
I have a requirement to call Java API from BSP application.
I have checked the forum and found that it is possible by using some ABAP codes.
However there is no pointer on how this is done.
Can someone explain the details on how to call Java API from BSP is done?
I found class CL_EJB_JAVA_OBJECT_METHODS to call a method in EJB but can't find function or SAP class to call Java API.
Actually is there any BSP extention which can used to call Java API?
Thanks,
Hendricheck out these weblogs, it should give you an idea how to go about it.
/people/ignacio.hernndez/blog/2006/12/04/speech-synthesis-listen-the-application-server-is-talking-to-you
/people/puru.govind/blog/2006/12/20/let-abap-speak
Regards
Raja -
How to call java implementations from C language
How to call java implementations from C language....
I know using JNI java can call C code....is the converse also possible????
-RamsHow to call java implementations from C language....
I know using JNI java can call C code....is the
converse also possible????Yes.
Maybe you are looking for
-
It worked fine up until a couple of days ago. I uninstalled it and then reinstalled it and keep getting this error message. What do I do?
-
Windows cannot recognize iPOD mini
I just bought a new iPOD mini (pink 4Gb), but when I conected the iPOD to my laptop and other desktop, the computer always shows 'cannot recognize the usb device, the divice might be malfunction', so iPOD shown as unknown device in my usb controller,
-
I have updated my iPad to iOS 5.1 now it won't connect to WiFi. Help!
I downloaded iOS 5.1 to my IPad2 last night and since then I have not been able to connect it to the internet. It shows the Network but it wont connect to it
-
Just updated my iPad to iOS 7 and now all of my photos taken in the last few months are duplicated, ones older than that are fine Any ideas or just have to wait for an update?
-
Yahoo messenger performance after installing massages
yahoo messenger performance become bad after installing massages my massages to the receiver delayed 5 sec and sometimes more than that. I used to use ichat before without problems with Yahoo. in addition adding friends from yahoo server becomes bad