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 Hendriks
Hi 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
Similar Messages
-
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 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 -
Call a component controller methods from a view
Hi,
I have created a view v1 with context node c1and binded the context node c1 of it with the component controller so that the values entered in the view v1 are available.
now can i know how to access this values from component controller context node which i binded in a other view......
Thanks,
PremHi Sayan,
component : BP_HEAD
View: BP_HEAD/BPHeadOverview
I have called event EH_ONPOPUP_CLOSED when popup is closed in view BP_HEAD/BPHeadOverview and i get all the values entered in the popup here using below code.
lr_context_node = gr_popup->get_context_node( iv_cnode_name = 'ZPOPUPCN' ).
lr_col_wrapper = lr_context_node->collection_wrapper.
lr_entity = lr_col_wrapper->get_current( ).
IF lr_entity IS BOUND.
lr_entity->get_properties( IMPORTING es_attributes = ls_data ).
ENDIF.
now ls_data contains all the data entered in the popup ie. - firstname, lastname, house_no, street, city, postal code, country.....
now it have tried the below code to map/set the entries with the Account management - individual account creation screen.
data : ls_header TYPE crmst_header_object_buil, " BuilHeader
ls_header1 TYPE crmst_address_buil, " BuilStandardAddress
ls_header-firstname = ls_data-zfirstname.
ls_header-lastname = ls_data-zlastname.
ls_header1-house_no = ls_data-zhouseno.
ls_header1-street = ls_data-zstreet.
ls_header1-city = ls_data-zcity.
ls_header1-postl_cod1 = ls_data-zpostcode.
ls_header1-country = ls_data-zcountry.
ls_header1-telephonetel = ls_data-ztelno.
ls_header1-e_mailsmt = ls_data-zemail.
entity ?= me->typed_context->builheader->collection_wrapper->get_current( ).
IF entity IS BOUND.
entity->set_properties( EXPORTING is_attributes = ls_header ).
ENDIF.
entity1 ?= me->typed_context-> BuilStandardAddress->collection_wrapper->get_current( ).
IF entity IS BOUND.
entity1->set_properties( EXPORTING is_attributes = ls_header1 ).
ENDIF.
but the problem is both the entity is INITIAL. -
Calling comp controller attribute from iinside view
HI all,
I want to know how to call a component controller attribute from inside a View's method?
any sampe coding..?
Regards,
ShanthiWell, you can use the wizard. Just call any method from the component controller. The wizard will create you the code including the line how you will get a reference to the component controller, which is the point here.
After you have the reference to the component controller, let's say lo_component_controller, you can access its attributes like this:
lo_component_controller->your_attribute
Then of course delete the unnecessary lines of code.
Regards,
Karri -
How to call Custom or Component Controller methods from View Controller
Hy Guys,
how do I call Custom Controller or Component controller methods from a View or Context Controlller?
thanks in advance
JürgenHi Juergen
Yes it is possible, pls follow the below approach to access the component controller in context node class
1) since the standard component controller class is protect variable , declare a variable of type component controller in your controller class.
say for example the public variable you declared is g_comp_controller
2) now redefine the controller class method WD_CREATE_CONTEXT and add the below lines of code
g_comp_controller ?= me->comp_controller.
3) go to context node class (CNXX) there declare the varaible which of type controller class (IMPL) as public variable, for example g_owner
4) redefine the method IF_BSP_MODEL~INIT and write the below code
CALL METHOD super->if_bsp_model~init
EXPORTING
id = id
owner = owner.
g_owner ?= owner.
5) now the variable g_owner that is declared in (CNXX) contains reference to your controller class
6) in on_new_focus method access your component controller in the below manner and access the entities also.
DATA: lv_owner TYPE REF TO xxxxx_impl, " Implementation class
lr_comp_cont TYPE REF TO xxxx_bspwdcomponen_impl, " component controller class
lv_entity type ref to cl_crm_bol_entity.
lv_owner ?= g_owner.
lr_comp_cont ?= lv_owner->g_comp_controller.
IF lr_comp_cont IS BOUND.
lv_entity ?= lr_comp_cont->typed_context->mdfcampaign->collection_wrapper->get_current( ).
now lv_entity contains the value of component controller context node.
Thanks & Regards
Raj
Edited by: bmsraj on Sep 27, 2011 3:28 PM -
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. -
Call a view's method from Component Controller.
Hi
Is it possible to call a view's method from Component Controller.
Regards
NikhilHi Tummuru,
I have created an event in Component Controller by the name toMenuView. Now I created a method in which this event is getting fired. Foll. is the code of the method.
public void fireToMenuView( )
wdComponentAPI.getMessageManager().reportSuccess("fireToMenuView");
wdThis.wdFireEventToMenuView();
Now I have created an event handler "handleToMenuView" in the MenuView and subscribed the event handler to the event in Component Controller.
The control is reaching to the fire event in component controller but not to the Event handler in view controller.
What am I missing.
Regards
Nikhil -
Calling view method from component controller
Hi Experts,
How to refer a view method from component controller?if you have the view Instance, then you can call using the view instance. But this is not the correct apporach.
-
How to call a custom controller method from view
Hi,
I ve created a simple web service and consumed it in a model. Mapped the input & output parameters to custom controller context which in turn mapped to component controller's context which in turn to view's contexts.
How to call a custom controller method from view?
Please explain the syntax.
Regards,
Manoj.Hi Patralekha,
Give some idea for the below scenario:
I ve created a simple web service and consumed it in a model. What I did was
1) for the input parameters, mapped the node from view->custom controller->model
2)for the output parameter, mapping from model->custom controller->view.
It works fine.
But I don't want to access model nodes directly, rather I want to set the input param in somewhere else (like custom controller) before calling the appropriate method, same for the response also.
Share me your thoughts.
Regards,
Manoj. -
How to call another view controller's method from a view controller?
Hi,
Iam new to webdynpro . so pls clarify my doubt.
How to call another view controller's method from a view controller in the same Web Dynpro Component?
Thanks,
KrishnaHi,
The methods in a view are only accessible inside same view. you cannot call it outside the view or
in any other view although its in same component.
If you want to have a method in both views, then create the method in component controller and
from there you can access the method any where in whole component. -
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 -
Call a Webservice method from DotNetApplication
Hi all,
I have created One web service using Axis. My WebServices are below:
import java.util.*;
public class NHLService {
HashMap standings = new HashMap();
public NHLService() {
// NHL - part of the standings as per 04/07/2002
standings.put("atlantic/philadelphia", "1");
standings.put("atlantic/ny islanders", "2");
standings.put("atlantic/new jersey", "3");
standings.put("central/detroit", "1");
standings.put("central/chicago", "2");
standings.put("central/st.louis", "3");
public String getCurrentPosition(String division, String team) {
String p = (String)standings.get(division + '/' + team);
return (p == null) ? "Team not found" : p;
}Its name is NHLService.jws. Then I run this service in my localhost like this "http://localhost:8080/axis/NHLService.jws" It is running and show that
There is a Web Service here
Click to see the WSDL Now I can view the wsdl. Now I want to call this webservice method from DotNet Application.Please any one knows that can you guide me the steps.
Thanks in Advance,
Rajbut i don't understand a thing...
when i create a static stub client i link with the config-wsdl file the path of my webservices wdsl and the client compile and run well...
why with the servlet i had to link .class file or jar file??
thanks a loto -
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;
} -
Problem calling a Java Method from C++
hi everyone,
i'm using JNI and i'm trying to call a Java method from C++, this is the code:
SocketC.java
public class SocketC
private native void conectaServidor();
private void recibeBuffer()
System.out.println("HELLO!!!");
public static void main(String args[])
SocketC SC = new SocketC();
SC.conectaServidor();
static {
System.loadLibrary("Server_TCP");
Server_TCP.cpp
char* recibirSock()
int _flag = 1;
while(_flag != 0)
memset(buffer,0,sizeof(buffer));//Et la, celle pour recevoir
recv(sock,buffer,sizeof(buffer),0);
printf(" Mensaje del cliente: %s\n",buffer);
_flag = strcmp(buffer,"salir");
}//fin while
return buffer;
void enviarSock()
int _flag = 1;
getchar();
while(_flag != 0)
memset(buffer,0,sizeof(buffer));//procedimiento para enviar
printf("\n Escriba: ");
gets(buffer);
// err=scanf("%s",buffer);
send(sock,buffer,sizeof(buffer),0);
_flag = strcmp(buffer,"salir");
}//fin while
}//fin enviarSock
DWORD servicio(LPVOID lpvoid)//
char *buf;
printf("\n Cliente aceptado!!!!!\n");
buf=recibirSock();
return 0;
JNIEXPORT void JNICALL Java_SocketC_conectaServidor(JNIEnv *env, jobject obj)
//void main()
/*this is the problem i'm calling the method recibeBuffer*/
jclass cls = env->GetObjectClass(obj);
jmethodID mmid = env->GetMethodID(cls, "recibeBuffer", "(V)V");
if (mmid == 0)
return;
env->CallVoidMethod(obj, mmid); //llama a Java
WSAStartup(MAKEWORD(2,0),&wsa);//MAKEWORD dit qu'on utilise la version 2 de winsock
printf("TCP conexion Sockets\n\n");
//estimez vous heureux que je foute pas de copyright ;)
system("TITLE TCP Conexion Sockets (Version server)");
//fo avouer que c'est plus joli
int port;
printf("Port : ");//On demande juste le port, pas besoin d'ip on est sur un server
scanf("%i",&port);
sinserv.sin_family=AF_INET; //Je ne connais pas d'autres familles
sinserv.sin_addr.s_addr=INADDR_ANY;//Pas besoin d'ip pour le server
sinserv.sin_port=htons(port);
server=socket(AF_INET,SOCK_STREAM,0);//On construit le server
//SOCK_STREAM pour le TCP
bind(server,(SOCKADDR*)&sinserv,sizeof(sinserv));
//On lie les parametres du socket avec le socket lui meme
listen(server,SOMAXCONN);//On se met � �couter avec server, 0 pour n'accepter qu'une seule connection
printf(" Servidor conectado.");
while(1)
sinsize=sizeof(sin);
if((sock=accept(server,(SOCKADDR*)&sin,&sinsize))!=INVALID_SOCKET)
{//accept : acepta cualquier conexion
if (hReadThread = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)
servicio, 0, 0, &dwThreadID))
printf("\nHOLA!");
GetExitCodeThread(hReadThread,&dwExitCode);
CloseHandle (hReadThread);
else
// Could not create the read thread.
printf("No se pudo crear");
exit(0);
when i'm running the proyect i get this error:
C:\POT Files\UCAB\tesis\esmart\french>java SocketC
Exception in thread "main" java.lang.NoSuchMethodError: recibeBuffer
at SocketC.conectaServidor(Native Method)
at SocketC.main(SocketC.java:16)
i don't know why this is happening i got declare the method recibeBuffer in my SocketC.java class, but doesn;t work can anyone help me?
PD: sorry for my bad english i'm from VenezuelaNext time please paste your code between [code] tags with the code button just above the edit message area.
To answer your question, you wrote the wrong method signature. It should be:jmethodID mmid = env->GetMethodID(cls, "recibeBuffer", "()V");Regards
Maybe you are looking for
-
question: we purchased an ipod shuffle for our daughter while she was home on her college winter break. it was frustrating to set it up to say the least, some of that is our issue as we are not very tech-y people. she has a windows laptop, we have a
-
Upgrade of Forms 2.4 Character Mode to Forms 6i (6.0.8)
We have recenlty installed Oracle Applications 11i (11.5.5) on our Compaq Tru64 Unix Servers. The task is to now upgrade/migrate our existing Forms (2.4 - character based) to 6i (6.0.8). Question: What is the best way to migrate these forms? Is there
-
I have CFMX7 and I've linked my cfchart to a custom xml style: <cfchart format="flash" style="jio_bar"> But other than adding placement="right" to the <legend isVisible="false" showColumnLegend="true"> tag, I have not been able to find a difinitive l
-
Had to erase my hard drive.
I got my first ever virus I left the house for about 6 hrs while my GFs brother was watching the kids. When I came back my laptop was next to him I tried to turn it on a few hours after that and every time I did it would start and then freeze I tried
-
My macbook pro has service battery, what could happen if i upgrade the ram to 8gb
My macbook pro has service battery, what could happen if i upgrade the ram to 8gb