How to call view-controller method out of componentcontroller
Hello all,
my component implements a component-interface with method BACK.
Thus my componentcontroller has the interface Method BACK.
When triggering BACK from an foreign component, the implementation within the componentcontroller is called. So far so good.
Now I want to POPUP_AND_CONFIRM when BACK is hit. But this POPUP_TO_CONFIRM requires me to create an action. But I can't create an action within the componentcontroller.
I could realize the POPUP_AND_CONFIRM within the components view. But how can I call a view-method out of the componentcontroller?
Or does anybody have a better solution? (Maybe I could implement BACK within the view, but how to connect the componentcontroller-back-method with the views back-method?)
Thank you very much in advance...
Regards
I. Durmaz
You should never attempt to call view methods from outside the view. It is possible to register popop event handlers to methods of the component or custom controllers. From the online help:
For a few special cases it is useful to register event handlers for component controllers or custom controllers on the button events of a dialog box. For these cases, a special POPUP_TO_CONFIRM attribute of type IF_WD_POPUP_TO_CONFIRM_N has been implemented in the IF_WD_WINDOW interface. This interface provides precisely the methods with which event handlers for component and custom controllers can be registered on events of the dialog box.
http://help.sap.com/saphelp_nw70ehp2/helpdata/en/47/b9487e01602fe2e10000000a42189d/frameset.htm
Similar Messages
-
How to call jpf controller method from javascript
Can any one help me how to call pageflow controller method from JavaScript.\
Thanks.Accessing a particular pageflow method from Javascript is directly not possible unless we do some real funky coding in specifying document.myForm.action = xyz...Heres what I tried and it did not work as expected: I found another workaround that I will share with you.
1. In my jsp file when I click a button a call a JavaScript that calls the method that I want in pageflow like this: My method got invoked BUT when that method forwards the jsp, it lost the portal context. I saw my returned jsp only on the browser instead of seeing it inside the portlet on the page of a portal. I just see contents of jsp on full browser screen. I checked the url. This does make the sense. I do not see the url where I will have like test1.portal?_pageLabe=xxx&portlet details etc etc. So this bottom approach will notwork.
document.getElementById("batchForm").action = "/portlets/com/hid/iod/Batches/holdBatch"; // here if you give like test1.portal/pagelable value like complete url...it may work...but not suggested/recommended....
document.getElementById("batchForm").submit;
2. I achieved my requirement using a hidden variable inside my netui:form tag in the jsp. Say for example, I have 3 buttons and all of them should call their own action methods like create, update, delete on pageflow side. But I want these to be called through javascript say for example to do some validation. (I have diff usecase though). So I created a hidden field like ACTION_NAME. I have 3 javascript functions create(), update() etc. These javascripts are called onclick() for these buttons. In thse functions first I set unique value to this hiddent field appropriately. Then submit the form. Note that all 3 buttons now go to same common action in the JPF. The code is like this.
document.getElementById("ACTION_NAME").value = "UPDATE";
document.getElementById("batchForm").submit.
Inside the pageflow common method, I retriev this hidden field value and based on its value, I call one of the above 3 methods in pageflow. This works for me. There may be better solution.
3. Another usecase that I want to share and may be help others also. Most of the time very common usecase is, when we select a item in a drop bos or netui:select, we want to invoke the pageflow action. Say we have 2 dropdown boxes with States and Cities. Anytime States select box is changed, it should go back to server and get new list of Cities for that state. (We can get both states and cities and do all string tokenizer on jsp itself. But inreality as per business needs, we do have to go to server to get dynamic values. Here is the code snippet that I use and it works for all my select boxes onChange event.
This entire lines of code should do what we want.
<netui:anchor action="selectArticleChanged" formSubmit="true" tagId="selectPropertyAction"/>
<netui:select onChange="document.getElementById(lookupIdByTagId('selectPropertyAction',this )).onclick();" dataSource="pageFlow.selectedArticleId" >
<c:forEach items="${requestScope.ALL_ARTICLE}" var="eachArticle">
<%-- workshop:varType="com.hid.iod.forms.IoDProfileArticleRelForm" --%>
<netui:selectOption value="${eachArticle.articleIdAsString}">${eachArticle.articleItemName}</netui:selectOption>
</c:forEach>
</netui:select>
See if you can build along those above lines of code. Any other simpler approches are highly welcome.
Thanks
Ravi Jegga -
Calling view controller method from component controller method
Hi,
Is there any way to call view controller method from component controller method?
Thanks,Hi Khandal.
You should not make you component controller dependent from a view controller.
But what you can do is to define an event in the component controller. The view
controller can register for this event.
In the stage where you currently want to call the view controller method just fire
the event. In the event handler method in the view controller you can call the
method then.
Why do you need to call a view controller method? Can you give more details
about the scenario?
Cheers,
Sascha -
How to Call Event Handler Method in Another view
Hi Experts,
Can anybody tell me how to call Event handler Method which is declared in View A ,it Should be Called in
view B,Thanks in Advance.
Thanks & Regards
Santhoshhi,
1) You can make the method EH_ONSELECT as public and static and call this method in viewGS_CM/ADDDOC using syntax
impl class name of view GS_CM/DOCTREE=>EH_ONSELECT "method name.
or
2)The view GS_CM/ADDDOC which contains EH_ONSELECT method has been already enhanced, so I can't execute such kind of operation one more time.
or
3)If both views or viewarea containing that view are under same window , then you can get the instance ofGS_CM/DOCTREE from view GS_CM/ADDDOC through the main window controller.
lr_window = me->view_manager->get_window_controller( ).
lv_viewname = 'GS_CM/DOCTREE '.
lr_viewctrl ?= lr_window ->get_subcontroller_by_viewname( lv_viewname ).
Now you can access the method of view GS_CM/DOCTREE .
Let me know in case you face any issues.
Message was edited by: Laure Cetin
Please do not ask for points, this is against the Rules of Engagement: http://scn.sap.com/docs/DOC-18590 -
How to call backing bean method from java script
Hi,
I would like to know how to call backing bean method from java script.
I am aware of serverListener and [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
but i am running in to some issues with [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
regarding which i asked for help in other thread with subject ....Question on AjaxAutoSuggest article (Ajax Transactions Using ADF and J...)
The reason why i posted is ( though i realise both are duplicates) .. that threads looks as a specific question to that article hence i would like to ask the quantified problem is asked in this thread.
So could any please letme know how to call backing bean method from java script
Thanks
Murali
Edited by: mchepuri on Oct 24, 2009 6:17 PM
Edited by: mchepuri on Oct 24, 2009 6:20 PMHello,
May know how to submit a button autoamtically on onload of page with clicking a welcome alert box. the submit button has managed button too to show a message on console using SOP.
the problem is.
1. before loading the page a javascript comes on which i clicked ok
2. the page gets loaded and the button is there which gets automatically clicked and the managed bean associated with prints a message on console using SOP.
I m trying to do this through server listener and click listener. the code is(adf jspx page)
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1" binding="#{backingBeanScope.backing_check4.d1}">
<af:form id="f1" binding="#{backingBeanScope.backing_check4.f1}">
<af:commandButton text="commandButton 1"
binding="#{backingBeanScope.backing_check4.cb1}"
id="cb1" action="#{beanCheck4.submit1}"/>
<af:clientListener type="click" method="delRow"/>
<af:serverListener type= "jsServerListener"
method="#{backingBeanScope.backing_check4.submit1}"/>
<f:facet name="metaContainer">
<af:resource type ="javascript">
x=confirm("hi");
// if(x){
delRow = function(event){
AdfCustomEvent.queue(event.getSource(), "jsServerListener", {}, false);
return true;
</af:resource>
</f:facet>
</af:form>
</af:document>
</f:view>
<!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_check4-->
</jsp:root>
the backing bean code is -----
public class classCheck4 {
public classCheck4() {
public String submit1() {
System.out.println("hello");
return null;
} -
How to access the controller method from javascript onclick event?
Hi All,
I am totally new to development. And I got struck in calling a controller method from javascript function.
I have no idea about ajax and all those things. Please can anyone help me to solve this issue!
Thanks in advance.Hi,
As I know, you can use jQuery to do this, here is an example.
Example of your Controller Method.
[HttpPost] // can be HttpGet
public ActionResult Test(string id)
bool isValid = yourcheckmethod(); //.. check
var obj = new {
valid = isValid
return Json(obj);
and this would be your javascript function.
function checkValidId(checkId)
$.ajax({
url: 'controllerName/Test',
type: 'POST',
contentType: 'application/json;',
data: JSON.stringify({ id: checkId }),
success: function (valid)
if(valid) { //show that id is valid }
else { //show that id is not valid }
If you have further issues, I would suggest you move to MVC forum, it is appropriate and more experts will assist you.
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to call a bean method from javascript event
Hi,
I could not find material on how to call a bean method from javascript, any help would be appreciated.
RalphHi,
Basically, I would like to call a method that I have written in the page java bean, or in the session bean, or application bean, or an external bean, from the javascript events (mouseover, on click, etc...) of a ui jsf component. I.e., I would like to take an action when a user clicks in a column in a datatable.
Cheers,
Ralph -
How to call a AM method with parameters from Managed Bean?
Hi Everyone,
I have a situation where I need to call AM method (setDefaultSubInv) from Managed bean, under Value change Listner method. Here is what I am doing, I have added AM method on to the page bindings, then in bean calling this
Class[] paramTypes = { };
Object[] params = { } ;
invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
This works and able to call this method if there are no parameters. Say I have to pass a parameter to AM method setDefaultSubInv(String a), i tried calling this from the bean but throws an error
String aVal = "test";
Class[] paramTypes = {String.class };
Object[] params = {aVal } ;
invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
I am not sure this is the right way to call the method with parameters. Can anyone tell how to call a AM method with parameters from Manage bean
Thanks,
San.Simply do the following
1- Make your Method in Client Interface.
2- Add it to Page Def.
3- Customize your Script Like the below one to Achieve your goal.
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
operationBinding.getParamsMap().put("username", "oracle");
operationBinding.getParamsMap().put("role", "F1211");
operationBinding.getParamsMap().put("Connection", "JDBC");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
return null;
i hope it help you
thanks -
Calling main controller method from component view
Hi,
Because i want to re-use certain views, i've created components of em so i can re-use them in several places within the same view. The problem is that i have 1 main component which has several methods calling webservices. I want the other components to be able to call the methods of the maincomponent. I tried adding the main component to the Used Web Dynpro Components of another component. Then i added the main component in the properties of the view but then it says: Cycle in component usage definitions.
I can understand this because the main view creates instances of all other components, so the sub components cannot create the maincomponent again...but how do i then give a reference of the maincomponents controller to the sub components?
Much thanks,
Hugo HendriksHi Siarhei,
The problem of creating a Java class is that there i dont have access to certain classes for example when there is something with a webservice, i want to send a message back like
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
msgMgr.reportSuccess(message);
In a seperate java class, i dont have access to the wdComponentAPI! The only thing i want is kinda like a ServiceLocator to call different webservices. I do check roles of the user logged in the portal and stuff like that....How do you normally implement something like this? I have several views which have to make use of the locator....
I hope i dont need to create a seperate DC when i want to re-use a screen and want to call a service method of another class or so.........Sounds like much overkill for a screen with 2 inputfields and a button!
Anoop, i tried adding the mainController to the searchComponent by adding it to Used WebDynpro Components and then I added the mainController in the properties of the searchView so i can make use of it. In the searchcode i now can use the maincontroller but i still get the compiling message: Cycle in component usage definition!
best regards,
Hugo -
Call component controller method from view
Hi
I have created an action in view Thus its event handler is "OnActionDoSomething()"
And, I have a method in component controller "MethodSaySomething()".
Now, how can I call MethodSaySomething() from OnActionDoSomething().
OnActionDoSomething()
// Call MethodSaySomething() defined in component controller
ThanksHi,
To access the methods present in component controller from View , first u need to add the component controller as the required controller.
open the view controller --> switch to propertues tab --> add the component controller as required controller(click add controller).
Now in your action handler , write this below code to add the method:
wdThis.wdGet<COmponent Controller>().MethodSaySomething();
Hope it helps
Thanks and Regards, -
How to call a custom method of same view?
Hello
I am developing a WDA on ABAP. I kept 3 LTA (Link To Action, kind of hyper link) on the initial_view, they perform the below functions (pls. note all the below 3 are on the initial_view ONLY),
1) LTA_1 -> Creates 'A' -> The linked EVENT for this LTA is CREATE_A
2) LTA_2 -> Creates 'B' -> The linked EVENT for this LTA is CREATE_B
3) LTA_3 -> Creates 'A' and 'B' -> The linked EVENT(onAction) for this LTA is CREATE_A_and_B, fine.
I wrote the ABAP code for creating the 'A' for LTA_1 in the associated Event Handler(method), same way i did for B
Now, for LTA_3 (Event is CREATE_A_and_B), i do not want to replicate the code from LTA_1 and LTA_2.
1) So, i guess, i just call the above )Event Handler) methods sequentially in CREATE_A_and_B's ABAP editor, am i right?
2) If so, pls. let me know how to call these methods, say, just for A, so that i will call for B on my own. Normally, we call as below
my_Class->my_method_name
3) If so, there is not-optional parameter as WDEVENT, just i need to pass blank for it?
Thank youdata: wdevent TYPE REF TO CL_WD_CUSTOM_EVENT.
wd_this->CREATE_A ( exporting wdevent = wdevent ).
wd_this->CREATE_B ( exporting wdevent = wdevent ). -
Call View controller with some URL parameter
Hi
I have a 3rd party system which need to send some data to my CRM system.
One approch which is being suggested is by sending data by URL parameter.
I have made a new component for this and have provided the 3rd party with its URL .
The issue with calling a view controller URL along with some specific URL parameters is that i am not able to access its parameters.when i call method GET_PAGE_URL from the DOINIT method of the controller it does not provide me with the parameter list .
How can i access these URL parameters ?
Regards
AjitabhHI,
have a look at component CRM_UI_FRAME. In the page default.htm they extract URL parameters.
You have got the REQUEST variable in your view controller as well.
cheers Carsten -
Call view's method from component_controller
Hello,
I need to call a view's method from a component controller.
Does anybody know how this can be done?
Thank you.Hello,
Thanks for the info.
In this case. If I have a button on my ALV that takes a user to a different view how would that work?
Navigation is done using plugs. ALV is initialized in COMPONENT_CONTROLLER and it does no not have plugs. Would I have to create an object of a view where ALV is initialized and than call FIRE_TO_XXXXX_PLG method?
Thank you. -
How to call a private method in a JFrame
I have a Frame which has some properties like its size, bgcolor plus other parameters, as instance variables. There is a button on the Frame with the caption : "set properties". When one clicks on that button, a new frame should appear via which a user can change the values of the parameters of the main Frame (i.e size, bgcolor,..etc). The user would input the new values in the textfields or radio buttons that are on the new frame, and then click a submit button, which has to exist on the same NFrame. How can I do that so that when the submit button is pressed, the parameters values are updated and so is the display view ?
I made it this way : I created 2 classes, the main frame and the new Frame. I made the new Frame an instance variable of the main Frame. When the user clicks the " set properties" button on the main Frame, the new Frame is shown. The user enters new values for some of the parameters and clicks submit. The parameters in the new Frame are updated. UP TO HERE EVERYTHING WENT JUST FINE. Now, there is a private method in the main frame that changes the color, size, ...etc of the main frame according to the values stored in the instance variables color, size,...etc. THE QUESTION IS: How can the new Frame display the changes after the values have been updated ? That is, how can it call the "private" method in the main class?? Should the new class be a child class of the main class to be able to access it's private methods ??import java.awt.*;
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
public class CallingHome
SkinMod skinMod;
JPanel panel;
public CallingHome()
// send reference so SkinMod can call methods in this class
skinMod = new SkinMod(this);
JButton change = new JButton("change properties");
change.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
skinMod.showDialog();
JPanel north = new JPanel();
north.add(change);
panel = new JPanel();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(north, "North");
f.getContentPane().add(panel);
f.setSize(300,100);
f.setLocation(200,200);
f.setVisible(true);
public void setBackground(Color color)
panel.setBackground(color);
panel.repaint();
public static void main(String[] args)
new CallingHome();
class SkinMod
CallingHome callHome;
Random seed;
JDialog dialog;
public SkinMod(CallingHome ch)
callHome = ch;
seed = new Random();
createDialog();
public void showDialog()
if(!dialog.isShowing())
dialog.setVisible(true);
private void createDialog()
JButton change = new JButton("change background");
change.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
callHome.setBackground(getColor());
dialog.dispose();
JPanel p = new JPanel();
p.add(change);
dialog = new JDialog();
dialog.getContentPane().add(p);
dialog.setSize(200,100);
dialog.setLocation(525,200);
private Color getColor()
return new Color(seed.nextInt(0xffffff));
} -
How to call a WebService method using HttpsURLConnection?
Hi,
I want to know how i could use HttpsURLConnection to call a WebService method.
I can use the following:
String endpoint = "https://xyz:8443/axis/services/MSecurity";
System.setProperty("javax.net.ssl.keyStore", keyStorepath);
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
System.setProperty("javax.net.ssl.trustStore", trustStorePath);
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStorePassword", trustpass);
//Call Web Service
URL url = new URL(endpoint);
MSecuritySoapBindingStub service = new MSecuritySoapBindingStub(url, null);
//get list of people
String[] vo = service.getVO();
for (int i = 0; i < vo.length; i++) {
System.out.println(vo);
However, loading my cert. this way is not flexible. Therefore, I am using SSLContext to initialize my keystore and truststore and then I am using the following to connect to my webservice:
SSLContext sc = SSLContext.getInstance("SSLv3");
sc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
SSLSocketFactory ssf = sc.getSocketFactory();
URL url = new URL(endpoint);
HttpsURLConnection htp = (HttpsURLConnection) url.openConnection();
htp.setSSLSocketFactory(ssf);
However, I do not know how I could use the "htp" object to call the getVO() method above.Use Apache Axis to do SOAP in Java.
Nobody can just mail you the code. You first have to create java source files from the web service via its WSDL file.
Maybe you are looking for
-
I have a gift card I want to use in iTunes but when I go to purchase it asks for my password, how do I use the gift card not credit card
-
Disk is too slow (Record)(-10004) error..so sick of this.
Hello all, I can no longer record more than three tracks in logic without getting the error message "Disk is too slow (Record)(-10004)". When this happens, recording is stopped. At first I suspected my drive was faulty, maybe slowing down. So being i
-
Can I run OS 10.6.4 on my brand new MacBook Pro?
I am a professional photographer and one of the programs I need in order to do my job is some software from Nikon that apparently will not run on Lion, OS 10.7.3. Documentation says that it can run on OS 10.6.4, Snow Leopard. Can I run OS 10.6, Snow
-
Few queries regarding auditing
Hi All , Greetings. I have some queries regarding auditing. 1.How to enable auditing for create table and truncate table by a user ? SQL> audit table by schema_name; Audit succeeded.Got to know the above from :http://psoug.org/reference/auditing.html
-
Help!!