Calling FP Methods with Javascript
I'd like to be able to jump to specific pages in my
flashpaper document using an html / javascript link. My javascript
function setThePage gets a page number from the HTML link and feeds
the value to the flash file (which my flashpaper movie clip loads
into). That value is then dumped into a function that eventually
sets the setThePage value equal to setCurrentPage, which is listed
in the flashpaper API as the function that changes the current
page. I've had no luck. I'm getting a javascript error telling me
the object doesn't support the method or function and I think it
has to do with the setCurrentPage function only working on the load
of the flashpaper swf. Does anyone have a different solution for
using html links to jump to specific flashpaper pages?
Rich,
I am interested in doing similar things from within a
FlashPaper document loaded into my Flash movie. I wish to create
links within the FlashPaper doc. that will talk to Actionscript in
the main movie. I know that using the Flash 8 ExternalInterface
Class is key, but in creating links in a Word Doc that eventually
becomes FP, I haven't a clue. It's easy enough to create links that
navigate to other URLs, or with the same page, but with the parent
Flash movie...
Anyway, if you have discovered anything, please share. I will
also, should I discover anything. Thanks, Mike.
mailto:[email protected]
Similar Messages
-
Call applet method with javascript
my html - code:
<APPLET NAME="Mail" ... ... ></APPLET>
<form action="javascript:document.applets("Mail").test("Execute JAVA Applet Function")">
<input type="submit" value="Execute Applet Function">
</form>
my applet code:
public void test(String t)
{System.out.println("executing test()");
teststr = t;
repaint();
in the paint() method i draw the teststr with Graphics.drawString - but nothing happens...
any suggestions?
thxDirectly calling a Java Applet's public method from within
JavaScript is made possible by LiveConnect which is not implemented by Internet Explorer as of yet. LiveConnect is only available on Netscape navigator at this time. -
Calling a method with a string
Here's the question:
I want to call a method with the name equal to a string variable.
For example, if the string variable contains "hellojava" , i'd like the hellojava() method to be called..
if the string contains "error", the error() method should be called..
and so on..:)Here is an example I had thrown together for this
purpose of the exact demonstration, Ar'nt you in luck.:-). If there is anything you don't understand,
I can be reached at [email protected] and will be happy to help....
import java.lang.reflect.*;
import java.io.*;
class Test {
String name = "Default";
public Test(String name) {
this.name = name;
public void test() {
System.out.println("Hello");
public void count() {
for(int i=0; i<10; i++) {
System.out.println(i);
public static void main(String[] args) {
try {
Test myObject = new Test("test1");
Class myClass = myObject.getClass();
BufferedReader bRead =
new BufferedReader(
new InputStreamReader( System.in ));
String bufStr = null;
while( (bufStr = bRead.readLine()) != "exit") {
Method noParams = myClass.getDeclaredMethod(bufStr, new Class[] {});
noParams.invoke(myObject, new Object[] {});
}catch(Exception e) {
System.out.println("No Such Method.");
}Good Luck,
-- Ian -
Calling a method with parameters in jstl?
i need to call a method with a series of String parameters what am i doing wrong?
the java
public ArrayList getEmployeeSkills(String ename, String snmae, String yearsexp)the jstl
<jsp:useBean id="empskill" class="com.Database.EmployeeSkill"/>
<c:forEach var="emp" items="${empskill.EmployeeSkills(null, null, null)}">
</c:forEach>this works:
<jsp:useBean id="empskill" class="com.Database.EmployeeSkill" scope="page">
<jsp:setProperty name="empskill" property="ename" value="Helen Smith"/>
<jsp:setProperty name="empskill" property="sname" value="Java"/>
</jsp:useBean>but this part isnt:
<c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
</c:forEach>ive removed the get part from the method as i have done before from the java class it is calling:
public ArrayList getEmployeeSkillsReport()
but it produces:
org.apache.jasper.JasperException: Exception in JSP: /main.jsp:146
143: </jsp:useBean>
144:
145:
146: <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
147: </c:forEach>
148:
149:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.ServletException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
org.apache.jsp.main_jsp._jspService(main_jsp.java:244)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:109)
org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129)
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75)
org.apache.taglibs.standard.tag.el.core.ForEachTag.evaluateExpressions(ForEachTag.java:155)
org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:66)
org.apache.jsp.main_jsp._jspx_meth_c_forEach_3(main_jsp.java:590)
org.apache.jsp.main_jsp._jspService(main_jsp.java:232)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) -
Call applet methods from Javascript
Hello,
If I call applet method like :
function callbackFunc(){
var pp = appletID.getData();
alert(pp);
It works only if applet is deployed with <APPLET> tag or with javascript.
If applet is deployed using <Object> and <embed> tags, in browser console the error is :
TypeError: appletID.getData is not a function
I couldn't find why is that behaviour. What do I do wrong?
ThanksHi Paul,
(1)Seems to be your Java Runtime Environment path is still setted for JRE 1.3.0_01 and not for 1.3.1. So pelase go to the
Control Panel-->java plugin 1.3.1-->Advanced. Here you set the Java Runtime Environment to the JRE 1.3.1 version. Its better to remove the older version before installing the new version on JRE.
(2)<OBJECT> tag won't work for Netscape. You can only use <APPLET> or <EMBED> tag for Netscape.
Hope this will help you.
Anil
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support -
Call C# method from javascript in WebView and retrieve the return value
The issue I am facing is the following :
I want to call a C# method from the javascript in my WebView and get the result of this call in my javascript.
In an WPF Desktop application, it would not be an issue because a WebBrowser
(the equivalent of a webView) has a property ObjectForScripting to which we can assign a C# object containg the methods we want to call from the javascript.
In an Windows Store Application, it is slightly different because the WebView
only contains an event ScriptNotify to which we can subscribe like in the example below :
void MainPage_Loaded(object sender, RoutedEventArgs e)
this.webView.ScriptNotify += webView_ScriptNotify;
When the event ScriptNotify is raised by calling window.external.notify(parameter), the method webView_ScriptNotify is called with the parameter sent by the javascript :
function CallCSharp() {
var returnValue;
window.external.notify(parameter);
return returnValue;
private async void webView_ScriptNotify(object sender, NotifyEventArgs e)
var parameter = e.Value;
var result = DoSomerthing(parameter);
The issue is that the javascript only raise the event and doesn't wait for a return value or even for the end of the execution of webView_ScriptNotify().
A solution to this issue would be call a javascript function from the webView_ScriptNotify() to store the return value in a variable in the javascript and retrieve it after.
private async void webView_ScriptNotify(object sender, NotifyEventArgs e)
var parameter = e.Value;
var result = ReturnResult();
await this.webView.InvokeScriptAsync("CSharpCallResult", new string[] { result });
var result;
function CallCSharp() {
window.external.notify(parameter);
return result;
function CSharpCallResult(parameter){
result = parameter;
However this does not work correctly because the call to the CSharpResult function from the C# happens after the javascript has finished to execute the CallCSharp function. Indeed the
window.external.notify does not wait for the C# to finish to execute.
Do you have any solution to solve this issue ? It is quite strange that in a Window Store App it is not possible to get the return value of a call to a C# method from the javascript whereas it is not an issue in a WPF application.I am not very familiar with the completion pattern and I could not find many things about it on Google, what is the principle? Unfortunately your solution of splitting my JS function does not work in my case. In my example my CallCSharp
function is called by another function which provides the parameter and needs the return value to directly use it. This function which called
CallCSharp will always execute before an InvokeScriptAsync call a second function. Furthermore, the content of my WebView is used in a cross platforms context so actually my
CallCSharp function more look like the code below.
function CallCSharp() {
if (isAndroid()) {
//mechanism to call C# method from js in Android
//return the result of call to C# method
} else if (isWindowsStoreApp()) {
window.external.notify(parameter);
// should return the result of call to C# method
} else {
In android, the mechanism in the webView allows to return the value of the call to a C# method, in a WPF application also. But I can't figure why for a Windows Store App we don't have this possibility. -
I have an embedded Applet in a web page, and I am trying to directly call a method in that Applet from the same page, using JavaScript.
Here is the complete Applet:
import java.applet.Applet;
public class Test extends Applet {
public String test() {
return "test() method return value";
}Here is the complete web page:
<HTML>
<HEAD><TITLE>Applet Invocation test</TITLE></HEAD>
<BODY>
<APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test"></APPLET>
<HR>
<SCRIPT>
document.write( "JavaScript is working<br>" );
document.write( document.test.test() );
</SCRIPT>
</BODY>
</HTML>Is there anything wrong with this? Because it works about 15% of the time, displaying an <HR>, "JavaScript is working", and then "test() method return value" on the next line.
The other 85% of the time, it just gets to "JavaScript is working", then I get a JavaScript error "Object does not support this property or method" for the line: document.write( document.test.test() );
Now here's another weird quirk... I can get it to work ALL the time, if I delay the execution of the Applet method. For example, if the first line after <SCRIPT> is alert( "alert" ); then the user gets a little dialog box with "alert" message in it, and when they hit OK execution continues, and the applet method call ALWAYS works. (On a side note, if I make the Applet test() method static, it NEVER works. Why is this?)
So it seems to me, that when it is failing, it is because the Applet is not completely loaded into the browser yet. My question is, how can I get around this?? Is there a way to instruct JavaScript to wait until the Applet is finished loading before attempting to call any methods on it?
PS I am using Windows ME and IE 6Thanks for the reply, I appreciate it. I have another question, if you don't mind... here is what my new test web page looks like:
<HTML>
<HEAD>
<TITLE>Applet Invocation test</TITLE>
<SCRIPT>
function testFunc()
document.write( document.test.test() );
</SCRIPT>
</HEAD>
<BODY onLoad="testFunc()">
<APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test">
</APPLET>
<HR>
</BODY>
</HTML>What happens is: the page loads, I see a 10x10 grey applet box, and a <HR>... then a split second later, onLoad is fired, and everything on the page so far is REPLACED with the output of testFunc(), so the ONLY thing on the page after this all completes is "test() method return value"
Why is a single document.write() statement CLEARING the page before outputting? I don't understand. If calling a document.write() from an onLoad event wipes out everything on the page, this is not extremely helpful solution. -
Call a method with complex data type from a DLL file
Hi,
I have a win32 API with a dll file, and I am trying to call some methods from it in the labview. To do this, I used the import library wizard, and everything is working as expected. The only problem which I have is with a method with complex data type as return type (a vector). According to this link, import library wizard can not import methods with complex data type.
The name of this method is this: const std::vector< BlackfinInterfaces::Count > Counts ()
where Count is a structure defined as below:
struct Count
Count() : countTime(0) {}
std::vector<unsigned long> countLines;
time_t countTime;
It seems that I should manually use the Call Library Function Node. How can I configure parameters for the above method?You cannot configure Call Library Function Node to call this function. LabVIEW has no way to pass a C++ class such as vector to a DLL.
-
Problem calling Java method from JavaScript in JSP / ADF
Hi all,
In my JavaScript onMouseUp() function, I need to call a method on my Java backing bean. How is this done? Info on the web indicates a static Java method can be called by simply "package.class.staticMethod(...)". but when I put the statement
"jsf.backing.GlobalRetriever.createBasemap(affectedLayer);"
I get an error message "jsf is undefined".
The functionality I'm trying to get is: I have a custom slider control and based on its value, I want to call oracle map viewer specifying a map extent of the (current extent / slider value) to do a zoom in/out. In addition, the slider uses a onMouseMove() function to change the size of the image display so it looks like a dynamic zoom in/out.
Please assist or let me know if I can provide some additional information. Thanks in advance.
Jim GreethamNo. The Java and Javascript in a Faces application are really working in two different universes.
Java is running on the server. It generates HTML (and sometimes even Javascript) and sends that to the client machine. That's where all your backing beans are.
Javascript runs directly in the browser. There's no way anything on the server can have access to anything you define in Javascript, unless you explicitly send that information back to the server, either via standard form submission (which only works when someone presses a "Submit" button) or via an Ajax-type call. So otherwise, nothing you define in Javascript will ever be available to a backing bean. -
Dynamic Imagelink Component - Calling Impl method with input parameter
Hi All,
I have requirement where Imagelinks are created dynamically on the pageload. Generated the components and the components are displayed on the jspx.
Now when I click the image link, a method in AMImpl should invoke and this method takes some input parameters.
I am able to call the method successfully in AMimpl with the help of below code. But I could not understand how to pass the input parameters to that method.
RichCommandImageLink lockimageLink =
new RichCommandImageLink();
lockimageLink.setIcon("icon.png");
lockimageLink.setId("icon" + index);
MethodExpression me =
JSFUtils.getMethodExpression("#{bindings." +
"MyMethodName" +
".execute}");
lockimageLink.addActionListener(new MethodExpressionActionListener(me));
public static MethodExpression getMethodExpression(String name) {
Class [] argtypes = new Class[1];
argtypes[0] = ActionEvent.class;
FacesContext facesCtx = FacesContext.getCurrentInstance();
Application app = facesCtx.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesCtx.getELContext();
return elFactory.createMethodExpression(elContext,name,null,argtypes);
} Can some one please suggest how to pass input parameters to the Impl method.
Jdeveloper Version : 11.1.1.4.0
Thanks,
Morgan.
Edited by: 900114 on May 12, 2012 11:23 PMYou can use the below method to call an AMImpl method. You can pass parameters as well to the AMImpl method.
DCBindingContainer bindings = getDCBindingContainer();
OperationBinding ob = bc.getOperationBinding("MyMethodName");
Map m = ob.getParamsMap();
ob.put("paramName", "paramValue"); paramName is the parameter in AMImpl and paramValue is the value to be passed.
ob.execute();
Where getDCBindingContainer() is:
public DCBindingContainer getDCBindingContainer() {
ExpressionFactory exprFactory;
ELContext elContext;
ValueExpression valueExpression;
DCBindingContainer dcBindingContainer;
FacesContext facesContext = FacesContext.getCurrentInstance();
exprFactory = facesContext.getApplication().getExpressionFactory();
elContext = facesContext.getELContext();
valueExpression =
exprFactory.createValueExpression(elContext, "#{bindings}",
Object.class);
dcBindingContainer =
(DCBindingContainer)valueExpression.getValue(elContext);
return dcBindingContainer;
Hope this helps
Edited by: umesh.agarwal on May 13, 2012 12:10 AM
Edited by: umesh.agarwal on May 13, 2012 12:10 AM -
Calling ABAP Class with Javascript (Example?)
Can anyone provide an example of calling an ABAP class with Javascript? I'm looking to retrieve a variable value from a Web Application
ThanksI need this too.
I have a Selection Screen in JAVA. And I want to fill the f4-help with a abap-function.
with kind regards
Maria Kiltz -
Call Java Method From JavaScript Function
hi everyone
i need a help in calling Java method from a javaScript method
ex:
function confirmAddRecord() {
cHours =document.getElementById('frmP:ChargeHours').value;
cSTime =document.getElementById('frmP:ChargeStartTime').value;
var answer = confirm("Are you sure you want to add Record?")
if (answer){
here i want to call the Java Method that is located in session bean that takes the upper params cHours & cSTime
else{
return false;
i know i can do it as an action button but it is required me to be in that way can any one help plz
Message was edited by:
casper77That depends on the nature of your parameters. I guess you calculate the params on client and then want to submit them. In this case and if you don't want to use Ajax simple add some <input type="hidden"> elements (of course there correspondend components dependent of your framework) and store the params there. If the javascript isn't invoked by a button click, you can use a button nevertheless. Set visible="false" and call
document.getElementById('client_id_of_my_hidden_button').click();
(or maybe doClick() dependent on your framework). -
Call Java method from JavaScript
Hi,
I have a Java class called abc.java and in that I have a method called assignValue(String value).
I need to call this method, assignValue() , from JavaScript.
Is there a way to call a Java method from JavaScript.
Any help is greatly appreciated.
Thanks.Yes I did, and I still don't get it, I have created a JSF web application, not an applet, as I posted earlier my code to executes sit's in a class file, not an applet file.
My Page1.class file is as follows
* Page1.java
package a1;
import ....
public class Page1 extends AbstractPageBean {
public void valset(int val) {
}my jsp file "Page1.jsp" is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<ui:page binding="#{Page1.page1}" id="page1">
<ui:html binding="#{Page1.html1}" id="html1">
<ui:head binding="#{Page1.head1}" id="head1">
<ui:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
</ui:head>
<ui:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
<ui:form binding="#{Page1.form1}" id="form1">
<applet code="Page1.class" name="Page1" width="1100" height="600">
</applet>
<ui:button action="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1" onMouseOver="form1.Page1.valset(1);"
style="left: 239px; top: 192px; position: absolute" text="Button"/>
</ui:form>
</ui:body>
</ui:html>
</ui:page>
</f:view>
</jsp:root>All I get is a grey box the size of the applet window. Could you please let me know what I'm doing wrong? -
Calling a method with a html Submit button
hi guys,
is it possible to call a method from a JSP file using a HTML submit button. I know i can call another website easily doing it this way, is there a similar way available to call a method once the button is clicked?
FYI
The method is in a bean file named jdbc. The methods name is getUsername.
Nice one.
<form action = <%jdbc.getUsername()%> <input type="submit" value="Submit">Dear friend,
you mentioned that u need to call a method when submit button is clicked. Is the method dynamically created. If not so, then you can include the method on the submit button html file itself.
Regards,
Rengaraj.R -
Using Java Reflection to call a method with int parameter
Hi,
Could someone please tell me how can i use the invoke() of the Method class to call an method wiht int parameter? The invoke() takes an array of Object, but I need to pass in an array of int.
For example I have a setI(int i) in my class.
Class[] INT_PARAMETER_TYPES = new Class[] {Integer.TYPE };
Method method = targetClass.getMethod(methodName, INT_PARAMETER_TYPES);
Object[] args = new Object[] {4}; // won't work, type mismatch
int[] args = new int[] {4}; // won't work, type mismatch
method.invoke(target, args);
thanks for any help.Object[] args = new Object[] {4}; // won't work, type
mismatchShould be:
Object[] args = new Object[] { new Integer(4) };The relevant part of the JavaDoc for Method.invoke(): "If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of a primitive type. If this attempt fails, the invocation throws an IllegalArgumentException. "
I suppose you could pass in any Number (eg, Double instead of Integer), but that's just speculation.
Maybe you are looking for
-
Specifying PDF Open Parameters in Word Import Scenario
I have created a number of URLs in a Word document that open on a specific page no. in PDF files e.g. http://www.adhc.nsw.gov.au/__data/assets/file/0008/228194/HomeModificationGuidelines.pdf#p age=4 The parameters function as expected when opened dir
-
when the application is deployed to the remote server. The only browser that will display the image correctly is IE9. Re: images do not show when deployed on remote server Any ideas?
-
Secure functionality Ultra Search Portlet
Hi, what do I have to do that the "Ultra Search Portlet" supports acl-functionality? If I activate a acl for a data source, then no results are displayed.
-
Anyone using RAW in iPhoto?
I am considering shooting more in RAW and wondered about iPhoto's RAW capabilities. I know iPhoto can handle RAW images, but with concessions (that I can't quite understand.) I do own Aperture, but have been slightly intimidated by it and wanted to h
-
Partial Failed installation flash 10.1
On my Powerbook PPC G4 (10.5.8), flash 10.1 installed fine and works with all browsers (safari, Opera, Firefox). On my Win 7 x64 machine life has not been so sweet. While it appears to work in IE 8 (going to youtube), I do not get a confirmation of v