Call appModule function inside a managed bean?
How can I call an Application Module public function from a managed bean?
FacesContext ctx = FacesContext.getCurrentInstance();
ectx = ctx.getExternalContext();
//Ask the container who the user logged in as
_userName = ectx.getRemoteUser();
// 1. Access the FacesContext
FacesContext fc = FacesContext.getCurrentInstance();
// 2. Create value binding for the #{data} EL expression
ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
// 3. Evaluate the value binding, casting the result to BindingContext
BindingContext bc = (BindingContext)vb.getValue(fc);
// 4. Find the data control by name from the binding context, here you must change to name of your AppModule name
DCDataControl dc = bc.findDataControl("AppModuleDataControl");
// 5. Access the application module data provider
ApplicationModule am = (ApplicationModule)dc.getDataProvider();
// 6. Cast the ApplicationModule to its client interface
appModule = (AppModuleImpl)am;
// 7. Call a method on the client interface
appModule.myMetod();
Similar Messages
-
Impossible to call a action handler in managed bean
Hello! I’d developed simple jsf-application using JDeveloper 10.1.3.3 that doesn’t use faces-config.xml for a nafigation.
Simple jsf page (page1.jspx) has only one command button:
<af:commandButton text="commandButton 1"
binding="#{backing_page1.commandButton1}"
id="commandButton1"
action="#{backing_page1.commandButton1_action}"
immediate="true"/>
Action is handled programmatically in managed bean Page1.java:
public String commandButton1_action() {
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.redirect("page2.jspx");
return null;
The sample application works fine.
Then I’d tried to use the same jsf app to develop PDK Portlet (Oracle PDK, not jsr-168). I used Portal 10.1.4 and OC4J 10.1.3.3.
The part of provider.xml:
<showPage class="oracle.portal.provider.v2.render.http.ResourceRenderer">
<resourcePath>/faces/page1.jspx</resourcePath>
</showPage>
Action is handled programmatically in managed bean Page1.java:
public String commandButton1_action() {
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.redirect("http://<hostname>:7778/portal/page/portal/SampleGroup/Sample6");
return null;
Unfortunately, the jsf page doesn’t call an action after submit of the button. It’s impossible to call any handler in managed bean. Although, it’s possible in usual jsf app.
I wonder that af:goLink on the page1.jspx works fine:
<af:goLink text="goLink 1" binding="#{backing_page1.goLink1}"
id="goLink1"
destination=" http://<hostname>:7778/portal/page/portal/SampleGroup/Sample6"/>
The ask: why jsf page can’t call an action handler in managed bean in case of a portlet development?
Thank you. AndrewThank you, Frank! I’d expected an answer from you:) I and my colleagues is your big funs:)
I’d understood Portal intercepts any event on a portal page before jsf event.
But, it’s possible to use struts for portlet development. I’d hoped there is the same approach for Faces too (oracle.portal.provider.v2.render.http.FacesRenderer - http://www.oracle.com:80/technology/products/webcenter/files/pdk_downloads/jpdk/oracle/portal/provider/v2/render/http/FacesRenderer.html).
WebCenter is fine product but one is expensive. May be, is there a way to develop jsf portlet outside webcenter?
Thanks, Andrew -
Calling a function inside a symbol?
Hi there,
I'm one of those flash-devs that are trying to get Edge Animate to do what I usually do in Flash, so I might be doing this the wrong way, but I've got a symbol with a function "inside" on my stage, and I wanna call that function from the stage.
I've been trying to use sym.getComposition().getStage().getSymbol("symbolName").functionName(); but it doesn't work.
I don't have any problems manipulating the symbol itself by calling .play() or .hide() so I know the path works....can anyone show me the right syntax to call a function inside a symbol?
Thx in advanceHi Abnesher,
An important principle to grasp is that symbols (and the stage is one of them) lies in parallel, despite the fact of instances of different symbols being nested one in another (and all in fine nested in the stage).
The consequence is that from inside your nested symbol you have no direct visibility of the function defined inside the stage symbol !
Inside the Stage symbol, in the document.compositionReady event handler :
sym.yourGlobalFunction = function( firstParameter)
// your stuff
Inside another symbol, in one of its events handlers :
sym.getComposition().getStage().yourGlobalFunction( 5);
Gil -
Call a function inside a package from a stored procedure
Hello:
I am kind of new to the stored procedure. Does anyone know how to call a function inside a package from another stored procedure?
I have a existing function (func_b) inside a package (pack_a) and it returns a cursor. I want to call this function from a stored procedure (proc_c) so that I use the data inside the cursor.
can I do the following in proc_c:
my_cursor1 SYS_REFCURSOR;
begin
my_cursor1 := exec pack_a.func_b
end
It will be very helpful if anyone can point me to any reading or example. Thank you very much for your information.guys:
Thank you for your information so far. I need some more help here. I was able to run the function in my stored procedure. However, I was not able to print the result on the screen to view the cursor result, although I am using dbms_output.put_line statement inside my stored procedure.
I use the following statement to execute my stored procedure on sql*plus. I can tell the stored procedure is executed successfully, but I did see anything printed:
DECLARE TEMP VARCHAR2(100);
BEGIN PROC_LAWS_CAD_NAME_SEARCH('LPD', 'TEST DEVICE ID', 'TEST LAST NAME', 'TEST FIRST NAME', 'F', '11112009', TEMP); END;
I tried to use 'set serveroutput on' and got the following error:
ERROR:
ORA-06502: PL/SQL: numeric or value error: host bind array too small
ORA-06512: at line 1
I am kind of confused now. thank you for your help.
Jack
Here is my procedure:
create or replace
PROCEDURE PROC_SEARCH
( AGENCY_ID IN VARCHAR2,
DEVICE_ID IN VARCHAR2,
L_NAME IN VARCHAR2,
F_NAME IN VARCHAR2,
SEX IN VARCHAR2,
DOB IN VARCHAR2,
CAD_NAME_SCH_RESULT_STR OUT VARCHAR2)
AS
v_agy_id varchar2(10);
v_device_id varchar2(20);
v_l_name varchar2(25);
v_f_name varchar2(15);
v_sex varchar2(1);
v_dob date;
-- this cursor is going to be used to store a list of warrant matching
-- name search criteria
cad_srch_cursor sys_refcursor;
objSrch SEARCH_RESULT_TEMP%ROWTYPE;
BEGIN
cad_srch_cursor := SEARCH_PKG.SEARCH('TESTING', 'TESTER', null, null,null, null, getPhonetic('TESTING'));
LOOP
FETCH cad_srch_cursor INTO objSrch;
EXIT WHEN cad_srch_cursor%NOTFOUND;
--insert into SEARCH_RESULT_TEMP (name_last) values (objSrch.name_last);
CAD_NAME_SCH_RESULT_STR := objSrch.name_last;
dbms_output.put_line('First:'||objSrch.name_first||':Last:'||objSrch.name_last||':Middle:'||objSrch.name_middle);
end LOOP;
END PROC_LAWS_SEARCH;
----------------------------------------- -
Call library function inside a conditiona​l disable bug
i'm trying to call a function in a dll using the call library function inside a conditional disable structure.
one of the parameters is a pointer to a C structure.
here is the prototype:
short in myfunction(short in DevNum, void *pMetrics);
outside of the conditional disable, LabVIEW allows me to wire the pMetrics parameter to a cluster.
if i put the function inside the conditional disable, LabVIEW doesn't allow me to wire it.
as a workaround, i put the cluster inside the conditional disable as well.
any ideas?Simply create a constant of the cluster and and put it outside the disable structure. Wire this constant to all inputs (left side terminal) of the Call Library Node. A Call Library Node (CLN) set to Adapt to Type does need a valid datatype to adapt too. This works from the outside side (right side terminal) of the CLN only if the according indicator is inside the same data structure. In older LabVIEW versions you actually had to always define the left side by wiring a constant or a dummy control to it.
This has to do with the algorithme that evaluates datatypes along wires. Making that algorithme go backwards (against the natural dataflow) inside one subdiagram without causing circular references or similar is already a challange. Doing that across diagram boundaries (case, disable, loop, etc. structures) is basically impossible without causing the entire edit operation to get very slow.
Message Edited by rolfk on 10-20-2009 08:28 AM
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Calling a Function inside a procedure
Can you call a function inside a procedure?...if so....how?
Not all built-in functions can be used directly in an assignment.
SQL> CREATE PROCEDURE p (p_val IN VARCHAR2) AS
2 l_v VARCHAR2(10);
3 BEGIN
4 l_v := DECODE(p_val,'YES','TRUE','FALSE');
5 END;
6 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE P:
LINE/COL ERROR
4/4 PL/SQL: Statement ignored
4/11 PLS-00204: function or pseudo-column 'DECODE' may be used inside
a SQL statement onlyTTFN
John -
How to call a function inside a class?
Hello, i am trying to fire a function onPress .. this
function is inside a class.
In this function i refer to another function inside the calss
to call a Tween. It never arrives in the second function.
I tried to make an example.
In the fla file i have:
var test:makeMovie = new makeMovie(this);
You will see a red squere and you can press on it. It should
run the tween class. Am i using the delegate class wrong?I always have to use test movie and trace a couple of times
each time I start to use Delegate.
It wraps function.apply I think, which I tend to use more
often.
try using:
Container.onPress = Delegate.create(this,setAlpha);
and then just
setTween()
inside your setAlpha....
That's conceptually how I think I would try it above if I was
doing something similar.
I'm not sure it would have the desired effect even if the
delegate was executed as you have it coded. Unless you want
setTween's execution scope to be the Container clip in which case
you might need to do what kglad said and change the Container
reference to 'this'.
The way you have it at the moment inside setAlpha the
Delegate.create is simply creating a function...and not excuting
it.
its like : function something(){trace('what')}
and not like : something();
Below is some quick code that helps show how things work.
Notice that I assigned the delegate function to mainFunc....so that
along with the last example might provide a clue. Just paste it on
a frame and take a look at what's happening. -
Calling a function inside an iFrame
I have a app I'm building that plays videos through an iFrame (src is our server). I want to have buttons in my client that when clicked can call functions inside the iFrame (e.g. play, pause). Obviously the problem is with doing this is browser security will not allow it. I understand AIR provides extra parameters for an iFrame to achieve this. I have been reading up on this and seen to get the impression that calling functions in the iFrame can only be done before the page loads?
Has anyone any basic examples of how I could achieve this?Not all built-in functions can be used directly in an assignment.
SQL> CREATE PROCEDURE p (p_val IN VARCHAR2) AS
2 l_v VARCHAR2(10);
3 BEGIN
4 l_v := DECODE(p_val,'YES','TRUE','FALSE');
5 END;
6 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE P:
LINE/COL ERROR
4/4 PL/SQL: Statement ignored
4/11 PLS-00204: function or pseudo-column 'DECODE' may be used inside
a SQL statement onlyTTFN
John -
Call bounded task flow from managed bean
Hi experts,
can we call a bounded task flow from a managed bean?
if yes , please explain.....
Thankz in advance
PMSHi john,
Thankz for ur reply........sorry if im asking stupid questions.
this is my tree selection handler
public void treeSelectionHandler(SelectionEvent selectionEvent) {
RichTree tree1 = (RichTree) selectionEvent.getSource();
RowKeySet rks2 = selectionEvent.getAddedSet();
Iterator rksIterator = rks2.iterator();
if (rksIterator.hasNext())
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
treeBinding = (JUCtrlHierBinding) ((CollectionModel)tree1.getValue()).getWrappedData();
JUCtrlHierNodeBinding nodeBinding = nodeBinding = treeBinding.findNodeByKeyPath(key);
DCIteratorBinding _treeIteratorBinding = null;
_treeIteratorBinding = treeBinding.getDCIteratorBinding();
JUIteratorBinding iterator = nodeBinding.getIteratorBinding();
String keyStr = nodeBinding.getRowKey().toStringFormat(true);
iterator.setCurrentRowWithKey(keyStr);
JUCtrlHierTypeBinding typeBinding = nodeBinding.getHierTypeBinding();
String targetIteratorSpelString = typeBinding.getTargetIterator();
if (targetIteratorSpelString.equals("${bindings.Iascat1View1Iterator}"))
System.out.println("Tree Selected*************"+targetIteratorSpelString);*
else
if(targetIteratorSpelString.equals("${bindings.Iascat2View1Iterator}"))
*System.out.println("Tree Selected**************"+targetIteratorSpelString);*
else
*System.out.println("Tree Selected**************"+targetIteratorSpelString);*
I hav bounded task flow for each iterator for creating new record......i hav to replace code for calling bounded task flow instead of printing statement
PMS -
Call a Function From a Backing Bean
Hello,
I am trying to call a PL/SQL function from a Backing Bean but i am getting a getDBTransaction error. Here is the example i was trying to do in a backing bean.
I Am getting the employee ID , sending it to a function that calculates the annual salary and then through a button whose code is in the backing bean, showing a message on the screen with the annual salary.
I am getting the JBO-25301 error.
Can't i use getDBTransaction in my backing bean.Please have a look at the following thread:
Stored Procedure -
Calling a function inside another class
I have the following two classes and can't seem to figure to figure out how to call a function in the top one from the bottom one. The top one get instantiated on the root timeline. The bottom one gets instantiated from the top one. How do I call functions between the classes. Also, what if I had another call instantiated in top one and wanted to call a function in the bottom class from the second class?
Thanks a lot for any help!!!
package
import flash.display.MovieClip;
public class ThumbGridMain extends MovieClip
private var grid:CreateGrid;
public function ThumbGridMain():void
grid = new CreateGrid();
public function testFunc():void
trace("testFunc was called");
package
import flash.display.MovieClip;
public class CreateGrid extends MovieClip
public function CreateGrid():void
parent.testFunc();kglad,
Although I agree that utilizing events the way you attempted in your suggestion is better for at least a reason of eliminating dependency on parent, still you code doesn't not accomplish what Brian needs.
Merely adding event listener to grid instance does nothing - there is no mechanism in the code that invokes callTGMFunction - thus event will not be dispatched. So, either callTGMFunction should be called on the instance (why use events - not direct call - in this case?), or grid instance needs to dispatch this event based on some internal logic ofCreateGrid AFTER it is instantiated - perhaps when it is either added to stage or added to display list via Event.ADDED. Without such a mechanism, how is it a superior correct way OOP?
Also, in your code in ThumbGridMain class testFunc is missing parameter that it expects - Event.
Am I missing something?
I guess the code may be (it still looks more cumbersome and less elegant than direct function call):
package
import flash.display.MovieClip;
import flash.events.Event;
public class ThumbGridMain extends MovieClip
private var grid:CreateGrid;
public function ThumbGridMain():void
grid = new CreateGrid();
grid.addEventListener("callTGMFunction", testFunc);
addChild(grid);
// to call a CreateGrid function named cgFunction()
public function callCG(){
grid.cgFunction();
public function testFunc(e:Event):void
trace("testFunc was called");
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.Event;
public class CreateGrid extends MovieClip
public function CreateGrid():void
if (stage) init();
else addEventListener(Event.ADDED, callTGMFunction);
// to call a TGM function
public function callTGMFunction(e:Event = null):void
// I forgot this one
removeEventListener(Event.ADDED, callTGMFunction);
this.dispatchEvent(new Event("callTGMFunction"));
public function cgFunction(){
trace("cg function called");
I think this is a case of personal preference.
With that said, it is definitely better if instance doesn't rely on the object it is instnatiated by - so, in this case, either parent should listen to event or call a function directly. -
Can't call a function inside another function
Hello,
i have the following function :
FUNCTION test_day_week (P_DATE DATE)
RETURN VARCHAR2 IS
BEGIN
RETURN TO_CHAR(P_DATE ,'DAY');
END;
--it returns the day name of a given date
FUNCTION TEST_DAY_NUMBER (P_DAY_NAME VARCHAR2)
RETURN NUMBER IS
V_RESULT NUMBER;
V_RETURN_DAY VARCHAR2(30);
P_DATE DATE;
BEGIN
V_RETURN_DAY := test_day_week (P_DATE );
MESSAGE('V_RETURN_DAY'|| V_RETURN_DAY);
MESSAGE('V_RETURN_DAY'|| V_RETURN_DAY);
IF V_RETURN_DAY = 'MONDAY' THEN V_RESULT :=1;
END IF ;
IF V_RETURN_DAY = 'TUSEDAY' THEN V_RESULT :=2;
END IF ;
IF V_RETURN_DAY = 'WENDSDAY' THEN V_RESULT :=3;
END IF ;
IF V_RETURN_DAY = 'THURSDAY' THEN V_RESULT :=4;
END IF ;
IF V_RETURN_DAY = 'FRIDAY' THEN V_RESULT :=5;
END IF ;
IF V_RETURN_DAY = 'SATURDAY' THEN V_RESULT :=6;
END IF ;
IF V_RETURN_DAY = 'SUNDAY' THEN V_RESULT :=7;
END IF ;
RETURN V_RESULT;
END;
--The above function returnds the day name in numbers
The proble is that when i call test_day_week function it returns no value even it is tested separatly and works fine don't know where is my problem :
1-number of argrments in function[b] TEST_DAY_NUMBER
?? and so ..!
Regards,
Abdetu..You could also cut the whole thing down to a simple function... (assuming you have a need to customise your start of week rather than use built in date functionality)
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION test_day_week (P_DATE DATE) RETURN NUMBER IS
2 BEGIN
3 RETURN (INSTR('MONTUEWEDTHUFRISATSUN',TO_CHAR(P_DATE,'DY'))+2)/3;
4* END;
SQL> /
Function created.
SQL> select test_day_week(sysdate) from dual;
TEST_DAY_WEEK(SYSDATE)
1
SQL> select test_day_week(sysdate+1) from dual;
TEST_DAY_WEEK(SYSDATE+1)
2
SQL> select test_day_week(sysdate+2) from dual;
TEST_DAY_WEEK(SYSDATE+2)
3
SQL> select test_day_week(sysdate+3) from dual;
TEST_DAY_WEEK(SYSDATE+3)
4
SQL> select test_day_week(sysdate+4) from dual;
TEST_DAY_WEEK(SYSDATE+4)
5
SQL> select test_day_week(sysdate+5) from dual;
TEST_DAY_WEEK(SYSDATE+5)
6
SQL> select test_day_week(sysdate+6) from dual;
TEST_DAY_WEEK(SYSDATE+6)
7
SQL> select test_day_week(sysdate+7) from dual;
TEST_DAY_WEEK(SYSDATE+7)
1
SQL> -
As3 call a function inside swf
I am loading an external swf like that. In the extrnal swf I
have a function called "foo". how can I call "foo" function from
the main swf?
Thankswhy not put the function in the main swf and eliminate the
other swf if thats all there is? i have no clue about how to deal
with multiple swf's. i'd say define it in the first frame of the
flash and call on it later -
Dynamically call different functions inside a function
Hi there,
I was wondering if it is possible to dynamically define the function that you want to call. Almost like passing the function name that i want to call as a parameter.
I am calling a function, but do not want to hardcode the function I am calling. I have different functions that all return a boolean value, and i want to call all of them at different times through the same procedure/function.
Is this possible???
Thank you in advance!
TanjaOr combine your functions to use function overloading, then you can use the same name...
SQL> ed
Wrote file afiedt.buf
1 create or replace package mypk as
2 FUNCTION gen_function (param1 IN NUMBER, param2 IN NUMBER) RETURN BOOLEAN;
3 FUNCTION gen_function (param1 IN VARCHAR2, param2 IN VARCHAR2) RETURN BOOLEAN;
4 FUNCTION gen_function (param1 IN BOOLEAN, param2 IN BOOLEAN) RETURN BOOLEAN;
5 PROCEDURE test;
6* end;
SQL> /
Package created.
SQL> ed
Wrote file afiedt.buf
1 create or replace package body mypk as
2 FUNCTION gen_function (param1 IN NUMBER, param2 IN NUMBER) RETURN BOOLEAN IS
3 BEGIN
4 RETURN (param1*2) = param2;
5 END;
6 FUNCTION gen_function (param1 IN VARCHAR2, param2 IN VARCHAR2) RETURN BOOLEAN IS
7 BEGIN
8 RETURN param1 = param2;
9 END;
10 FUNCTION gen_function (param1 IN BOOLEAN, param2 IN BOOLEAN) RETURN BOOLEAN IS
11 BEGIN
12 RETURN NOT(param1) = param2;
13 END;
14 PROCEDURE test IS
15 BEGIN
16 IF gen_function(1,2) THEN
17 DBMS_OUTPUT.PUT_LINE('Test1: True');
18 ELSE
19 DBMS_OUTPUT.PUT_LINE('Test1: False');
20 END IF;
21 IF gen_function('Fred','John') THEN
22 DBMS_OUTPUT.PUT_LINE('Test2: True');
23 ELSE
24 DBMS_OUTPUT.PUT_LINE('Test2: False');
25 END IF;
26 IF gen_function(TRUE,FALSE) THEN
27 DBMS_OUTPUT.PUT_LINE('Test3: True');
28 ELSE
29 DBMS_OUTPUT.PUT_LINE('Test31: False');
30 END IF;
31 END;
32* end;
SQL> /
Package body created.
SQL> exec mypk.test;
Test1: True
Test2: False
Test3: True
PL/SQL procedure successfully completed.
SQL>;) -
How to get the main funciton name when calling another function inside?
for eg, one RFC named A,inside A,a funtion B is called.when the processing is at B now,how can i get the main RFC name(A)?
any help will be much appricated.> just see SM50,there is a column called 'Report',it shows the program id the proess is now processing.but i don't know its main program or say it 'the process's first excuting program',how can i get it programmatically?
I'm still not sure to understand. The program in SM50 is the current main program (not the first). It is stored in SY-REPID system variable. Or use this code:
DATA lt_callstack_long TYPE abap_callstack.
DATA ls_callstack_long TYPE LINE OF abap_callstack.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
callstack = lt_callstack_long.
READ TABLE lt_callstack_long INDEX 1 INTO ls_callstack_long.
WRITE : / 'current main program is:', ls_callstack_long-mainprogram.
If you want to know the frame program (the first called), use SY-CPROG, or use this code:
DATA lt_callstack_long TYPE abap_callstack.
DATA ls_callstack_long TYPE LINE OF abap_callstack.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
callstack = lt_callstack_long.
" read last line = first called program
DESCRIBE TABLE lt_callstack_long. "to make sy-tfill = number of lines
READ TABLE lt_callstack_long INDEX sy-tfill INTO ls_callstack_long.
WRITE : / 'First main program is:', ls_callstack_long-mainprogram.
Maybe you are looking for
-
Why can't i access the app store on my iphone 5
Please why can't I access the app store on my iPhone 5....it keep saying can't access.. I'm from Nigeria
-
Netflix and Youtube (internet option) is not working on Apple TV 2 I bought - please advise how to fix this. Please note this is not to do with signing in as the internet menu and option to sign in is not given at all on screen/within ATV2. The onl
-
Picture Tweaks/Calibration for TOSHIBA 32C100U 32" LCD
I just bought and hooked up a 32" LCD TV from Toshiba, model C100U and am looking to get help with calibration tweaks in order to achieve the best picture and performance possible. I'm hoping someone will be able to provide assistance...fingers cross
-
To send attachment file using SMTP
Hi, Can anybody help me to send an attachment file using SMTP? Regards, Rakesh
-
Hello, I am trying to navigate to another page within my application upon the click of checkbox. Obviously since there is no action attribute, I need to write my own custom navigaton handling. In the valueChangeListener method of this checkbox I have