How to invoke a method in JApplet from javascript.
We want to invoke a method in JApplet from javascript.
with the help Java Plug-in HTML Converter Version 1.3, we have generated OBJECT/EMBED tag for
the following applet tag.
<APPLET CODE = "SimpleApplet" WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
MAYSCRIPT = true>
<PARAM NAME = "p1" VALUE = "v1">
</APPLET>
it is given the following code
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.3 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
<PARAM NAME = CODE VALUE = "SimpleApplet" >
<PARAM NAME = NAME VALUE = "simpleApplet" >
<PARAM NAME = MAYSCRIPT VALUE = true >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="false">
<PARAM NAME = "p1" VALUE = "v1">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.3" CODE = "SimpleApplet" NAME =
"simpleApplet" WIDTH = 200 HEIGHT = 300 MAYSCRIPT = true p1 = "v1" scriptable=false
pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT>
</NOEMBED></EMBED>
</OBJECT>
<!--
<APPLET CODE = "SimpleApplet" WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
MAYSCRIPT = true>
<PARAM NAME = "p1" VALUE = "v1">
</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
But, even after trying to invoke method in the JApplet from javascript, it is not being invoked in
Netscape. it is being invoked from
IE after changing the scriptable = true. Is there any such parameter to change, to invoke the
method in JApplet from javascript?
can anybody give any suggestion?
hi there,,
well the same problem exists with my code also, NS fails to call the function from java applet... if u get the answer please mail me on [email protected]
Similar Messages
-
Invoke a method in JSP from applet?
Hi,
Does anyone know how to invoke a method defined in JSP when a button within an applet is clicked?
Thanks in advance.Hi
What you are trying is basically an Applet to Servlet communication. This is definitely possible. To perform a GET to a Servlet create a URL object with the request parameters included. Create a URLConnection by opening a connection to the URL object. Then access the ServletInputStream to get the reply from the Servlet.
To perform POST the process is similar but remember to set the DoInput and DoOutput properties of the URLConnection object to true.
Obtain the ServletInputStream and ServletOutputStream to recieve and send Data.
Keep me posted on your progress!
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc.
http://www.sun.com/developers/support -
Question on "How-to invoke a method once upon application start"
Hello everyone.
I'm trying to implement what the article "How-to invoke a method once upon application start" by Frank suggests.
https://blogs.oracle.com/jdevotnharvest/entry/how_to_invoke_a_method
Suppose that I'm having a single point of entry, so in my login.jpsx I have the below:
<f:view beforePhase="#{login.onBeforePhase}">In the method "onBeforePhase" I have to pass the phaseEvent, since the signature is the following:
public void onBeforePhase(PhaseEvent phaseEvent)but how do I know the phaseEvent when calling the login.onBeforePhase? How the call should be?
Thanks a lot!
ps. I'm using jDev 11.1.2.1.0You need not pass anything to this method , this method will get called before every Phase except ReStore View
Just write the logic as Frank suggested for the phase in which you want the code to execute. You can get the PhaseId's like
PhaseId.RENDER_RESPONSE
public void onBeforePhase(PhaseEvent phaseEvent) {// from Frank's doc
//render response is called on an initial page request
if(phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE){
... etc -
Error while accessing a public method of applet from javascript.
Hi,
I am getting "Object doesn't support this property or method" error
when accessing a public method of applet from javascript in IE 6 using
document.applets[0].myMethod();
The same is working in IE 7.
Thanks in advance.
Regards,
PhanikanthI don't know why it happens, but this works for me in both versions:
<applet ..... name="MyApplet">
</applet>and in javascript use
document.MyApplet.myMethod() -
How to call java function with parameter from javascript in adf mobile?
how to call java function with parameter from javascript in adf mobile?
The ADF Mobile Container Utilities API may be used from JavaScript or Java.
Application Container APIs - 11g Release 2 (11.1.2.4.0) -
How to invoke action method from mail contained link
Hello,
my application needs to send mails to users that include links for the user to click on. Something like www.mysite.com/displayData.jsp&id=123. My question is now how I make JSF invoke the respective method in the backed bean to display the data with the id 123 when the user clicks on the link int the mail.
I wonder whether there is some kind of "catch-all action" that checks whether the user is logged in and authorized whenever any JSP page is invoked. I'm a bit tired of first checking the authorization of some user before processing the remaining part od the backed bean's action method.
Thanks for any hints,
Oliver Plohmannmy application needs to send mails to users that
include links for the user to click on. Something
like www.mysite.com/displayData.jsp&id=123. My
question is now how I make JSF invoke the respective
method in the backed bean to display the data with
the id 123 when the user clicks on the link int the
mail.I dont think there is a way to submit to an action on click of a link. Only possible solution is to invoke the method from the constructor of your Backing Bean and populate the bean fields displayed on your page.
I wonder whether there is some kind of "catch-all
action" that checks whether the user is logged in and
authorized whenever any JSP page is invoked. I'm a
bit tired of first checking the authorization of some
user before processing the remaining part od the
backed bean's action method. You can try out a Servlet filter for doing this. -
Urgent please ! How to invoke java method with diffrent argument types?
Hi,
I am new to JNI.
I had gone through documentation but it is not of much help.
Can any one help me out how to invoke the below java method,
// Java class file
public class JavaClassFile
public int myJavaMethod(String[] strArray, MyClass[] myClassArray, long time, int[] ids)
// implementation of method
return 0;
// C++ file with Invokation API and invokes the myJavaMethod Java method
int main()
jclass cls_str = env->FindClass("java/lang/String");
jclass cls_MyClass = env->FindClass("MyClass");
long myLong = 2332323232;
int intArray[] = {232, 323, 32, 77 };
jclass cls_JavaClassFile = env->FindClass("JavaClassFile");
jmethodID mid_myJavaMethod = env->GetMethodID( cls_JavaClassFile, "myJavaMethod", "([Ljava/lang/String;[LMyClass;J[I)I");
// invoking the java method
//jint returnValue = env->CallIntMethod( cls_JavaClassFile, mid_myJavaMethod, stringArray, myClassArray, myLong, intArray ); --- (1)
//jint returnValue = env->CallIntMethodA( cls_JavaClassFile, mid_myJavaMethod, ...........); --- (2)
//jint returnValue = env->CallIntMethodV( cls_JavaClassFile, mid_myJavaMethod, ...........); --- (3)
Can any one tell me what is the correct way of invoking the above Java method of (1), (2) and (3) and how ?
The statement (1) is compilable but throws error at runtime, why ?
How can I use statements (2) and (3) over here ?
Thanks for any sort help.
warm and best regards.You are missing some steps.
When you invoke a java method from C++, the parameters have to be java parameters, no C++ parameters.
For example, your code appears to me as thogh it is trying to pass a (C++) array of ints into a java method. No can do.
You have to construct a java in array and fill it in with values.
Here's a code snippet:
jintArray intArray = env->NewIntArray(10); // Ten elments
There are also jni functions for getting and setting array "regions".
If you are going to really do this stuff, I suggest a resource:
essential JNI by Rob Gordon
There is a chapter devoted to arrays and strings. -
How to invoke the method for af:cmdtoorbarbtn having af:showpopbehavior
Hi,
Please help me to invoke the method on click the <af:commandToolbarButton> which having <af:showPopBehavior> as child tag.
Here the code snippet:-
<af:commandToolbarButton icon="/icons/field_group_plus_ena.png"
hoverIcon="/icons/field_group_plus_ovr.png"
depressedIcon="/icons/field_group_plus_dwn.png"
disabledIcon="/icons/field_group_plus_dis.png"
shortDesc="#{bundle.ADD_TAG}"
useWindow="true">
<af:showPopupBehavior popupId="popupDialogForEditTagConf"/>
</af:commandToolbarButton>
<af:popup id="popupDialogForEditTagConf">
<af:dialog title="#{bundle.SELECT_TAG}"
dialogListener="#{TagHelper.selectTagDialogCB}">
<f:facet name="buttonBar"/>
<af:panelCollection featuresOff="detach">
<f:facet name="menus"/>
<f:facet name="toolbar"/>
<f:facet name="statusbar"/>
<af:treeTable value="#{bindings.tagTree.treeModel}"
var="it" disableColumnReordering="true"
rowSelection="single" rowBandingInterval="1"
columnStretching="false" id="TagTree"
binding="#{TagHelper.tagTree}">
<f:facet name="nodeStamp">
<af:column sortable="false"
headerText="#{bundle.TAG_NAME}"
width="250">
<af:outputText value="#{it.name}"/>
</af:column>
</f:facet>
<af:column sortable="false" width="250px"
headerText="#{bundle.DESCRIPTION}">
<af:outputText value="#{it.description}"/>
</af:column>
</af:treeTable>
</af:panelCollection>
</af:dialog>Hi,
you cannot invoke the showPopupBehavior component action programatically. Instead, to programatically launch a popup, you use client side JavaScript as explained in the WebDeveloper guide http://download.oracle.com/docs/cd/E12839_01/index.htm . Note that the JavaScript can be launched from a managed bean
Frank -
How to invoke a method in application module or view objects interface?
Hi,
perhaps a stupid RTFM question, but
How can i invoke a method that i have published in the application modules or view objects interfaces using uiXml with BC4J?
Only found something how to invoke a static method (<ctrl:method class="..." method="..." />) but not how to call a method with or without parameters in AM or VO directly with a uix-element.
Thanks in advance, MarkusThanks for your help Andy, but i do not understand why this has to be that complicated.
Why shall i write a eventhandler for a simple call of a AM or VO method? That splatters the functionality over 3 files (BC4J, UIX, handler). Feature Request ;-)?
I found a simple solution using reflection that can be used at least for parameterless methods:
<event name="anEvent">
<bc4j:findRootAppModule name="MyAppModule">
<!-- Call MyAppModule.myMethod() procedure. -->
<bc4j:setPageProperty name="MethodName" value="myMethod"/>
<ctrl:method class="UixHelper"
method="invokeApplicationModuleMethod"/>
</bc4j:findRootAppModule>
</event>The UixHelper method:
public static EventResult invokeApplicationModuleMethod( BajaContext context,
Page page,
PageEvent event ) {
String methodName = page.getProperty( "MethodName" );
ApplicationModule am = ServletBindingUtils.getApplicationModule( context );
Method method = null;
try {
method = am.getClass( ).getDeclaredMethod( methodName, null );
} catch( NoSuchMethodException e ) {
RuntimeException re = new RuntimeException( e );
throw re;
try {
method.invoke( am, null );
} catch( InvocationTargetException e ) {
RuntimeException re = new RuntimeException( e );
throw re;
} catch( IllegalAccessException e ) {
RuntimeException re = new RuntimeException( e );
throw re;
return null;
}Need to think about how to handle parameters and return values.
Btw. Do i need to implement the EventHandler methods synchronized?
Regards, Markus -
How to invoke a bean in WLS from a servlet in JWS
Hi,
I have an application where in i am invoking an EJB in WLS from a servlet in JWS.Could any one give me the correct steps to approach this problem.Till now i was using WLS as webserver itself.can i use the same t3 protocol in my client servlet in JWS.I can't use apache webserver b'cos ,my application is to run in windows platform.
Thanks in advance,
Ramasubramanian
hi there,,
well the same problem exists with my code also, NS fails to call the function from java applet... if u get the answer please mail me on [email protected] -
How to invoke bean method after query executed?
Jdeveloper 11.1.1.2:
I have a bean that backs a JSF page.
The bean has a method that shows/hides certain GUI components based on the values of other components.
I would like to invoke this method automatically after the page has been fully loaded.
I tried invoking the method in the AfterPhase of the f:view and at bean construction time. Both approaches failed.
I think I need a listener that gets invoked after the query has been executed.
Any idea?
thanksHi,
if the bean is a backing bean and it is supposed to hide components, then why don't you create a reference of the components to the backing bean so that the displayed property is dynamically evaluated ? Sounds like this is what you want to do
Frank -
How to call function in the plugin from javascript?
Hi,
I have some function inside my plugin which i want to call from javascript. Is it possible? Sorry, im new to plugin programming.
For example, i have plugin with function func() which i want to call from external javascript. In what way i will be able to achieve this?
Thanks.Thank you sir for the help.
Is it possible to assign ID to function and specifying that ID during executeAction call in script?
Like at the time of executeaction call we will specify pluginID and functionID as parameter so that function will execute from the respective plugin. Is it possible ?
Thanks. -
How to get latest flash player version from javascript code
Hello,
I want to know the latest flash player version number programmatically to compare with currently installed flash player version.
I have requirement in which i need to show message to user when installed flash player version < latest flash player version.
there is no API offlash player available which we can call to get the latest flash player version.
We tried to do webscrapping of adobe site which prints version number but we need to do this from javascript.
Is there any way through which we can come to know wether our installed flash player version is older than latest flash player released version?
Please help..
Thanks
DhwaniIt's in the Global Settings Manager in the Control Panel (Windows) or System Preferences (Mac), but I'm unaware of a javascript you can create to do this independent of a Flash container.
The best you can do would be to create a web page with the expressInstall.swf and swfobject_modified.js added to a Flash container in the page. While that won't give a detailed (installed vs new) indication, it WILL prompt for an update if the current version is higher than the installed version.
You'd then have to add the webpage to startup items, so the end user would see it on login. -
How to invoke Java method from C++
Hi
My requirement is In C++ we are having three different structures, like
struct one{
int accontno;
char * accountholdername;
long balance;
struct two{
int startdate;
int enddate;
struct three{
char* userid;
char* userpassword;
from c++ how to pass these structures, these structures I have to read in Java class, and in java how receive these structures.
And the sample methods will be like: getCarsData(Input, output, Error);
How do i call the method in JNI, if it is static int method we can call like
getStaticIntMethodID(), instead of int if i have to pass the above mentioned structures how do i do? Should i create an object array in JNI for accessing these three structures?
Suggestions/Samples welcome
Thanks,Why did you start another thread for this?
I was answering you in the [url http://forum.java.sun.com/thread.jspa?threadID=712137&messageID=4119725#4119725]old thread and you didn't even bother to answer back my (basic) questions.
I told you to use the code tags when pasting code. Got ignored. I also gave you a starting example on how to achieve your goal. Flushed.
Oh well, I'm getting used to it.
Again.
Before starting, allways keep near you the [url http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html]JNI reference. All the JNI functions are documented in it.
First you need to create custom Java classes that will match the C++ stucts (remember?).
There is no magic wand in JNI that will transform the C++ structs into the custom Java classes and vice versa.
You'll have to code it by hand, one field at a time. It's a pain.
So for the one, two, three C++ structs (why not posting some real names instead of this crap?),
there will be JOne, JTwo and JThree Java classes.
There is also that other Java class already existing with getCarsData() static method that will fetch the data.
And finally the DLL function wich will call this Java static method, doing the bridge between the C++ structs and the custom Java classes, finally return the data.
Due to the lack of explanation from your posts, I will say that the getCarsData() static method receives a parameter of type JOne
and returns an array of JTwo objects.
So the get_cars_data() DLL function receives a parameter which is a struct one and
returns a pointer to an array of struct two elements.
// C++ structs
struct one {
int accontno;
char * accountholdername;
long balance;
struct two {
int startdate;
int enddate;
struct three {
char * userid;
char * userpassword;
// custom Java classes
class JOne {
int accontno;
String accountholdername;
int balance;
class JTwo {
int startdate;
int enddate;
class JThree {
String userid;
String userpassword;
// Java class with static method that gets the data
class DataFetcher {
static JTwo[] getCarsData(JOne one) {
// DLL function
// struct 'one' parameter is already filled with values.
// Returns an array of 'two' C++ struct obtained from a Java static method
two * get_cars_data(one o) {
JNIEnv * env;
/** not show here is the code to either
create the JVM or
attach it to the current thread **/
// get the data from 'one' C++ struct and put it in a new instance of JOne Java class
jclass oneCls = env->FindClass("JOne");
jmethodID oneCtorID = env->GetMethodID(oneCls, "<init>", "()V");
jfieldID accontnoID = env->GetFieldID(oneCls, "accontno", "I");
jfieldID accountholdernameID = env->GetFieldID(oneCls, "accountholdername", "Ljava/lang/String;");
jfieldID balanceID = env->GetFieldID(oneCls, "balance", "I");
jobject oneObj = env->NewObject(oneCls, oneCtorID);
env->SetIntField(oneObj, accontnoID, o.accontno);
env->SetObjectField(oneObj, accountholdernameID, env->NewStringUTF((const char *)o.accountholdername));
env->SetIntField(oneObj, balanceID, o.balanceo);
// call the Java static method
jclass dfCls = env->FindClass("DataFetcher");
jmethodID getCarsDataID = env->GetStaticMethodID(dfCls, "getCarsData", "(LJOne;)[LJTwo;");
jobjectarray twoArray = (jobjectarray)env->CallStaticObjectMethod(dfCls, getCarsDataID, oneObj);
// create the 'two' C++ struct array from the Java array of JTwo objects
jclass twoCls = env->FindClass("JTwo");
jfieldID startdateID = env->GetFieldID(twoCls, "startdate", "I");
jfieldID enddateID = env->GetFieldID(twoCls, "enddate", "I");
jint len = env->GetArrayLength(twoArray);
two * pt = new two[len];
for (int i = 0; i < len; i++) {
jobject twoObj = env->GetObjectArrayElement(twoArray, i);
pt.startdate = env->GetIntField(twoObj, startdateID);
pt[i].enddate = env->GetIntField(twoObj, enddateID);
// return the resulting 'two' C++ struct array
return pt;
Regards -
How to invoke a OSB Proxy Service from a Servlet??
Hi!!
I'm a begginer in OSB, and right now I have a OSB configuration in production mode. So, using the console test it's very easy to test (doh) my configuration. But now, I have to make a stress test and after read a lot of documentation I did'nt found the way to do that. So I'm trying to do it by using a Servlet, a doPost method in especific, but after a lot of time I can't invoke the proxy service.
What is the right way to use a proxy service in production mode??
How can I call it from my servlet??
How can I send an xml (or any other object, file, text...) as a Request??
Help please, thank you...
Edited by: user12116998 on 18-mar-2010 12:40If you have your proxy service published as http/soap, then I recommend you to use SoapUI to test it. It can help you with stress test too.
Maybe you are looking for
-
How do I Expand the Text Box in Mail Stationery?
I have a question about using stationery in Mail. Is there anything I can do to make the text box in certain templates to hold more content? It seems that, in some templates (like Bamboo, for example), the text box expands automatically as more conte
-
I'm trying to make a lopping .gif from an animation that I made. It's 147 total frames. It's crashed about 6 times now every time I either try and Save for Web or even just save the document on my desktop so in case it crashes I can reopen PS and rec
-
Converting air-sap2602i-s-k9 from autonomous to LWAPP
Hi guys, I need your expertise regarding how to convert from autonomous to LWAPP using AIR-SAP2602i-s-k9 with IOS version of ap3g2-k9w7-xx.152.-2.JA. I'm following these commands but it is not available debug capwap console cli or debug l
-
Hello!!!! I have created a Polar plot, but there is a line that shouldn't be there, what do I have to modify, so it shows exactly what I want??? I Have attached a picture of the graphs that I want, and my example VI, I hope someone can help me. Sorry
-
Premiere CS6 Crashing when rendering effects
I started having an issue after the latest update version 6.0.3 was installed in March. Previous jobs (HD 1280x720) that did render will not render now! After days of trial and error I discovered the crash occurs at every Transition Point (video or .