Call JavaScript-Method from Command in NW04s WebApplication
Hi,
I would like to use a command to call a JavaScipt-method. Is that possible?
I want to use a JavaScript generated from the following command as an ACTION_BEFORE_RENDERING-event.
<bi:TEMPLATE_PARAMETERS name="TEMPLATE_PARAMETERS" >
<bi:WEB_TEMPLATE_ACTIONS type="COMPOSITE" >
<bi:ACTION_BEFORE_RENDERING type="COMPOSITE" >
<bi:INSTRUCTION >
<bi:SET_ITEM_PARAMETERS >
<bi:cmd_item_parameters type="TEMPLATE_INCLUDE_ITEM" >
<bi:TEMPLATE value="AIS_ANZEIGE_BETRIEB_NW_04" text="Stammdatenanzeige für Betrieb NW 04" />
</bi:cmd_item_parameters>
<bi:TARGET_ITEM_REF value="TEMPLATE_INCLUDE_ITEM_2" />
</bi:SET_ITEM_PARAMETERS>
<bi:SET_SELECTION_STATE_SIMPLE >
<bi:TARGET_DATA_PROVIDER_REF_LIST type="ORDEREDLIST" >
<bi:TARGET_DATA_PROVIDER_REF index="1" value="DP_2" />
</bi:TARGET_DATA_PROVIDER_REF_LIST>
<bi:CHARACTERISTIC value="AISIS003___F00069" text="" />
<bi:RANGE_SELECTION_OPERATOR type="CHOICE" value="EQUAL_SELECTION" >
<bi:EQUAL_SELECTION type="CHOICE" value="MEMBER_NAME" >
<bi:MEMBER_NAME value="17630775" />
</bi:EQUAL_SELECTION>
</bi:RANGE_SELECTION_OPERATOR>
</bi:SET_SELECTION_STATE_SIMPLE>
</bi:INSTRUCTION>
</bi:ACTION_BEFORE_RENDERING>
</bi:WEB_TEMPLATE_ACTIONS>
</bi:TEMPLATE_PARAMETERS>
I want to assign a new WebTemplate to an included WebTemplate and also assign a filter value to the new loaded DataProvider.
It works as a command, but I only want the new WebTemplate to be loaded, if the corresponding filter is set. Otherwise I want to load a different WebTemplate. I think I have to use JavaScript here, but I don't know how to link that to the ACTION_BEFORE_RENDERING-event.
Any ideas?
Thanks in advance.
Denis
Sorry, Javascript is not Java and for sure not JSF.
Repost the question at a forum devoted to Javascript.
There are ones at [webdeveloper.com|http://www.webdeveloper.com] and [dynamicdrive.com|http://www.dynamicdrive.com].
I can give you at most one hint: [DOM reference|https://developer.mozilla.org/en/DOM].
Good luck.
Similar Messages
-
Calling javascript method from java
Hi this is sri,
I have one doubt on Java Applets "how to call the javascript method from java Applet".Can u give me the complete sample code for one program(both java applet file and html file also)because i can easily understand the programming flow.
Thanks ,
Srilekha.It's an extremely important skill to learn how to search the web. Not only will it increase your research and development talents, it will also save you from asking questions that have already been answered numerous times before. By doing a little research before you ask a question, you'll show that you're willing to work and learn without needing to have your hand held the entire time; a quality that is seemingly rare but much appreciated by the volunteers who are willing to help you.
If you've done the research, found nothing useful, and decide to post your question, it's a great idea to tell us that you've already searched (and what methodologies you used to do your research). That way, we don't refer you back to something you've already seen.
To get you started, here's a link...
http://www.google.com/search?q=call+java+from+javascript -
Call Javascript methods from Java methods
Dear All,
I have a requirement where I need to invoke Javascript methods from a Java file located in the same machine. Are there any possible solutions for this?
Regards,
AlokHi,
Thanks for all your replies. Does this work on Java 5 too? Could you please share the complete code snippet which makes it work? I tried working on yours but no success.
Regards,
Alok -
How call javascript method from parent window to iframe
hi....
i need to call javascript a method which located in iframe..
in my java script file i used like this.
window.frames[0].getHtml();
it will working in IE but mozilla is not supporting
pls help me..
thanks
Edited by: fsfsfsdfs on Nov 7, 2008 1:02 AMSorry, Javascript is not Java and for sure not JSF.
Repost the question at a forum devoted to Javascript.
There are ones at [webdeveloper.com|http://www.webdeveloper.com] and [dynamicdrive.com|http://www.dynamicdrive.com].
I can give you at most one hint: [DOM reference|https://developer.mozilla.org/en/DOM].
Good luck. -
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. -
Calling methods from Command prompt
Hi,
OK this may seem crazy:).
Is it possible to call a method from the command prompt directly?.
For eg. I have a class UFOSeeker that has a static method getPosinSky.
Is it possible to just call this method directly form the cmd prompt?, something like this
[neo@zeno ~]java UFOSeeker.getPosinSky()
The . is wrong i know, but is there a way?.
Reason for asking this, just bored and wondering whether this would be possible?.
TIA,
krisYou could do it via another class and use reflection.
For example:
public class CallStaticMethod
public static void main(String[] args)
String className = args[0].substring(0, args[0].lastIndexOf('.'));
String methodName = args[0].substring(args[0].lastIndexOf('.')+1, args[0].indexOf('('));
try
Class clazz = Class.forName(className);
Method meth = clazz.getMethod(methodName, new Class[0]);
meth.invoke(null, new Object[0]);
catch ( Exception e )
e.printStackTrace();
}You would then run:
java CallStaticMethod package.Class.method()
or in your example
java CallStaticMethod UFOSeeker.getPosinSky()
The code above does not do anything about passing in parameters or getting return types. If you are really bored you could add it in. -
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). -
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 call a method from another class
I have a problem were i have to call a method from another class. What is the command line that i have to use. Thanks.
Here's one I wipped up in 10 minutes... Cool!
package forums;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import krc.utilz.io.Filez;
import java.io.FileNotFoundException;
class FileDisplayer extends JFrame
private static final long serialVersionUID = 0L;
FileDisplayer(String filename) {
super(filename);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setSize(600, 800);
JTextArea text = new JTextArea();
try {
text.setText(Filez.read(filename));
} catch (FileNotFoundException e) {
text.setText(e.toString());
this.add(text);
public static void main(String args[]) {
final String filename = (args.length>0 ? args[0] : "C:/Java/home/src/forums/FileDisplayer.java");
try {
java.awt.EventQueue.invokeLater(
new Runnable() {
public void run() {
new FileDisplayer(filename).setVisible(true);
} catch (Exception e) {
e.printStackTrace();
Filez.read
* reads the given file into one big string
* @param String filename - the name of the file to read
* @return the contents filename
public static String read(String filename) throws FileNotFoundException {
return Filez.read(new FileReader(filename));
* Reads the contents of the given reader into one big string, and closes the reader.
* @param java.io.Reader reader - a subclass of Reader to read from.
* @return the whole contents of the given reader.
public static String read(Reader in) {
try {
StringBuffer out = new StringBuffer();
try {
char[] bfr = new char[BFRSIZE];
int n = 0;
while( (n=in.read(bfr,0,BFRSIZE)) > 0 ) {
out.append(bfr,0,n);
} finally {
if(in!=null)in.close();
return out.toString();
} catch (IOException e) {
throw new RuntimeIOException(e.getMessage(), e);
}Edited by: corlettk on Dec 16, 2007 1:01 PM - dang [code [/tags][ -
Is there anyway to call a method in Controller.jpf from a jsp page? I want to have my jsp page call a method from the jpf controller through an onChange event in the select tag. Otherwise I will have to write a large amount of javascript directly into my jsp page and really defeats the purpose of the MVC architecture. Any help is greatly appreciated. Thanks in advance.
The jsp might look something like this:
<netui:form action="DoThisOnChange">
<!--all other jsp stuff-->
<netui:select dataSource"" optionsDataSource="" onChange="this.form.submit()"/>
</netui:form>
And in JPF declare action named "DoThisOnChange" and write the logic to be done on event "onChange".
--SJ -
Call java method from pl/sql
Hello,
i have library written in java and i need call one method from this lib in pl/sql. it's returning string. Is it possible? If, yes can you direct me to some docs about this topic? We have oracle version 8 and 10.
Thanks a lot.i think java support was added to oracle from 8i. is you package is in the form of jar file or java code.?
you can you jdeveloper the best one i found for writing java and sqlj stored procedures
you can use loadjava here is a cut and paste from a example i have on my system
REM Server-side translation, execution of SQLJ program
REM
REM Environment setup:
REM - have sqlj and javac in your PATH
REM - SQLJ libaries in your CLASSPATH
REM
REM In the directory having the SQLJ demo for the server,
REM execute the following commands
REM Drop any previously-loaded demo classes
sqlplus scott/tiger @Dropl
REM Load the SQLJ source directly
call loadjava -oci8 -resolve -force -user scott/tiger ServerDemo.sqlj
REM Publish SQL wrapper and run the demo on the server using SQL*Plus
sqlplus scott/tiger @Run.sql
REM In sqlplus, it should print
REM Hello! I'm SQLJ in server!
REM Today is <date> -
Operation not found error while calling AM methods from managed bean
Hi,
operation not found error while calling AM methods from managed bean.
written a method with two parameters in AM.
exposed the method in AM client interface
in the page bindings added the method in method action ..left empty in the value fields of the parameters.
calling the method from managed bean like below
String userNameVal = (String)userName.getValue();
String passwordVal = (String)password.getValue();
OperationBinding operationBinding =
ADFUtils.findOperation("verifyLogin");
operationBinding.getParamsMap().put("userName",userNameVal);
operationBinding.getParamsMap().put("password",passwordVal);
operationBinding.execute();
i am getting operation verifyLogin not found error.Please suggest me something to do.
Thanks
SatyaHi vlsn,
Can you try with the below code
// in your backing bean
OperationBinding operation = bindings.getOperationBinding("verifyLogin");
//Put your both parameters here
operation.getParamsMap().put("parameter_name1", parameterValue1);
operation.getParamsMap().put("parameter_name2", parameterValue2);
operation.execute();
if (operation.getResult() != null) {
Boolean result = (Boolean) operation.getResult();
and share the result.
regards,
Rajan -
Calling a method from a super class
Hello, I'm trying to write a program that will call a method from a super class. This program is the test program, so should i include extends in the class declaration? Also, what code is needed for the call? Just to make things clear the program includes three different types of object classes and one abstract superclass and the test program which is what im having problems with. I try to use the test program to calculate somthing for each of them using the abstract method in the superclass, but its overridden for each of the three object classes. Now to call this function what syntax should I include? the function returns a double. Thanks.
Well, this sort of depends on how the methods are overridden.
public class SuperFoo {
public void foo() {
//do something;
public void bar(){
//do something
public class SubFoo extends SuperFoo {
public void foo() {
//do something different that overrides foo()
public void baz() {
bar(); //calls superclass method
foo(); //calls method in this (sub) class
super.foo(); //calls method in superclass
}However, if you have a superclass with an abstract method, then all the subclasses implement that same method with a relevant implementation. Since the parent method is abstract, you can't make a call to it (it contains no implementation, right?). -
Need help calling a method from an immutable class
I'm having difficulties in calling a method from my class called Cabin to my main. Here's the code in my main if(this is where i want my method hasKitchen() from my Cabin class)
System.out.println("There is a kitchen.");
else
System.out.println("There is not a kitchen.");
}and here's my method from my Cabin class:public boolean hasKitchen()
return kitchen;
}You should first have an instance of Cabin created by using
Cabin c = ....
if (c.hasKitchen()) {
System.out.println("There is a kitchen.");
} else {
System.out.println("There is not a kitchen.");
} -
Calling a method from another file
This is pretty basic stuff but i can't seem to get it right. I am calling a method from another file. The other file IS located in the same folder BUT when i compile i get errors
"cannot find symbol" <===referring to limit and sieve i believe.
The method name is "sieve" the file name is "PrimeSieve2008" and "limit" is the variable in brackets in the real method.
public static void main (String [] args) {
final int [] PRIMES;
int sieve = PrimeSieve2008.sieve(limit);
PRIMES = sieve(getValidInt());
for (int j = 0; j<PRIMES.length; j++) {
System.out.println("Prime[" + j + "] = " + PRIMES[j]);
Is "int sieve = PrimeSieve2008.sieve(limit)" the wrong way to call a file?
Thanks a million,
Alex
Edited by: Simplistic2099 on Apr 3, 2008 7:47 PM
Edited by: Simplistic2099 on Apr 3, 2008 7:49 PMSimplistic2099 wrote:
the other method runs fine:
"public static int[] sieve(final int limit){
int candidate; // possible prime
int count; // no. of primes found
boolean[] mayBePrime = new boolean[limit+1];
// remaining possibilities
final int[] PRIMES; // array to return
// initialize mayBePrime
for ( int j = 0 ; j <= limit ; j++ ) {
mayBePrime[j] = true;
mayBePrime[0] = mayBePrime[1] = false;
// apply sieve, and count primes
candidate = 2;
count = 0;
while ( candidate <= limit ) {
if ( mayBePrime[candidate] ) {
count++;
for ( int j = 2 * candidate ; j <= limit ; j += candidate ) {
mayBePrime[j] = false;
} // end for
} // end if
candidate++;
} // end while
// fill up new array with the primes found
PRIMES = new int[count];
count = 0;
for (int j = 2 ; j <= limit ; j++ ) {
if ( mayBePrime[j] ) {
PRIMES[count] = j;
count++;
} // end if
} // for
return PRIMES;
} // sieve
I really am clueless here.in this one you are passing in limit.
in the other one you are getting limit from somewhere outside of main.
Maybe you are looking for
-
On Yahoo Groups, using Internet Explorer, one can use a clipboard function to post photos to messages. When using Firefox, the clipboard doesn't appear and you cannot post photos on group messages.
-
Vertical photos distorted in slide show
I have 'scale photos to screen' turned off during slide show. Still, some vertical photos in my slide show, but not all, appear distorted as if they were horizontal; i.e. the horizontal dimension is stretched. When I preview the same photo, it 'reloa
-
Re: Precalc Server Working Process
Hi Can anyone explain me, how precalc server works. I have developed the workbook and executed using broadcaster. I want to know, the background process. When its is scheduled in broadcaster, initially thru rfc it calls the precalc server. then is th
-
E-load - Playing back a Scenario with a Specific Execution Order
Hi I have a doubt about scenarios in e-load: is there any way for a Scenario to run in a defined order? For example.. In one scenario I have 3 User Defined Profiles (UDP1, UDP2 and UDP3), is there a way to make the scneario playback the UDPs in order
-
How to change size of a picture in iPhoto?
how to change photo size in iphoto?