Access Application Class from Model Class in BSP

Hello,
I am developing a BSP Application based on MVC. Is there any way, I can access the Application Class's Attribute from a Method in the Model Class?
Thanksin Advance.
Regards
Gladson

Hello,
I solved it by passing the application class attribute to the model method, from the controller class.
Regards
Gladson

Similar Messages

  • Access application class

    Hai all,
    This is a basic question but as i am new to bsp i want to know the solution.  i want to know how to access a attribute in application class.For model class we create an instance and using the reference variable of instance created we access attributes or methods in model class.But this is not same for application class.So how to access attribute or method in application class?

    Hi,
    Here is a sample code to capture an event, here class CL_HTMLB_MANAGER: with the method GET_EVENT(which is of public)
    CALL METHOD cl_htmlb_manager=>get_event
      EXPORTING
        request = runtime->server->request
      RECEIVING
        event   = w_event. (w_event is a type of string declared in bsp application to capture the event)
    Hope this helps you,Let me know if any queries.
    Regards,
    Rajani

  • Binding variables of application class in bsp application.

    Hi,
    I know it is possible to bind the variables of model class like "//MODEL/VARIABLE" but is it possible to bind the variables of applicaiton class?
    Thanks and regards,
    Santosh.

    You have to remember that BSP evolved over several releases.  In 6.10 BSP released with no support for MVC - just the Application class. The application class was simply the way to share values between views and store them between requests in stateful applications.  It doesn't support any data binding.  In 6.20 BSP began to support MVC with the introduction of controller classes and model classes.  You data bind UI elements directly to model attributes only.  There is no concept of context.
    WD is completely different in that you only data bind UI element to the a context. The MVC structure is much cleaner because the view layout never has visibility to the model (regardless of what you consider the model). 
    Over time the assistance class has become the defacto standard for models in WDA, because unlike WDJ there is no direct model object.  It originally was intended mostly as a way of having text elements for WDA components.  However it is still perfectly acceptible to use service calls (proxy objects, function modules, class methods) as your model. I personally prefer to always wrap calls to my service object up in an assistance class for clear design.

  • Application Class in BSP

    Have any study material for application class usage in BSP ?
    Help me with a simple applcation class with one parameter.
    rgds,
    B

    Before answering your question, <b>a request</b>
    Can you close/reply/reward points to your earlier threads. This would encourage more people to come in to SDN and help each other.
    Now to your question:
    Check out this weblogs by Thomas Jung.
    /people/thomas.jung3/blog/2004/12/06/bsp-developers-journal-part-xv--stateful-bsp-and-timeouts
    though this for state management fo BSP application, you can see the usage of application class there, this would give you a point on to how this can be used.
    Regards
    Raja

  • ACCESSING APPLICATION SCOPE FROM FILTERS

    HI
    Is there any way to access the application scope from inside security filters? i have a class that implements the Filter interface and i'm trying to access the application scope in the doFilter method.
    The FacesContext Object is null, and i'm only able to access the session scope using request.getSession()
    I want to check for global application properties that are saved in the application scope.
    Thanks

    thank you BalusC it's working

  • Cannot Access Application Module from View Project (Swing)

    I recently started a new application workspace as a Swing project with Business Components. Jdev created 2 projects by default, a Model and a View. The model works fine, all the business components are funtctioning and the DB connection is good. When i try to create a reference to the application module in my View project i constantly get 'Class Not Found' exceptions no matter what i do. I am using the jbo.client.Configuration.getRootApplicationModule('amName', 'amConfig') method.
    What am i missing? How do i instantiate my application module from my View project?
    Thanks a lot.

    Just had to add the Model to the classpath...

  • Accessing Application Scope from an EJB

    I'm not sure of the best way of doing this:
    The set up:
    We have a rather large J2EE application that is composed of only servlets and JSPs at the moment (When the application began development EJB was in its infancy and not feasible for the development of the app). Some of the new deployments of the app involve distributed webserver over 4 JVMs and 2 machines. When a user connects the servers load balancing decides which particular JVM they should be connected to. We perform large data caching into the servlet application scope to avoid having to access the database every time a change is made by a user to certain tables in our database. The data caches are stored in hashtables in the servlet application scope.We seem to have no way to determine what other JVMs are running or which JVM a user is currently connected to.
    The problem:
    Apparently the application scope is for a particular JVM. This means that when a user makes a change to a data cache the change doesn't effect users in the other 3 JVMs of the application, only the users who, due to load balancing, happened to be connected to the same JVM as the one where the change was made.
    Our possible solution:
    We were thinking that we could set up a queue (such as MQSeries from IBM) and any time a change is made to one of these data caches put a message on the stack saying that the particular table had been updated. Then a MDB would be listening asynchronously and digest the message from the Queue and recache the tables from the database.
    So here are my questions:
    1. Would this work? Would putting a MDB in the EJB Container give each JVM the MDB in the first place, or would this mean it would pick one of the JVMs to deploy the MDB on and still not fix our problem.
    2. If this does work, how do I access the hashtables stored in the Servlet Application scope from the MDB. I can't seem to find any method available to the MDB (or any EJBs for that matter) that can access the servlets Application scope.
    3. Is this the best way to do this? Or is there a better way to share data between seperate JVMs that I don't have a URL to (It's all ambiguous and handled by the server as to which JVM actually gets the connection.)
    Just in case this is needed:
    We are running IBM WebSphere 5 Application Server and the database could be anything from DB2 to Oracle.
    Thanks in advance for any possible help.

    You wont get any api for directly accessing Servlet application objects from any ejb. I dont think MDB either solves your problem directly. Indirectly you can place a request to some servlet (should be there for each JVM and web application ) and update your application scope variable. I would suggest you to cache the data in database if the size of cache is large. otherwise any open caching tools may help you.

  • How to access application state from stateless web service?

    I have a beginner J2EE question. After reading through J2EE tutorial, I still don't know how to create an application that would run on J2EE server, and which would have a web service interface to other world, and which would have several threads running, which would connect to other enterprise applications via TCP? Because if I understand it correctly, web service requires a stateless session bean, which means that it can't access any stateleful session bean (except always create one and remove it instantly). So there seems to be no way to store application state and have running threads.
    I'm asking this because .NET seems to have a very simple Application dictionary, which can save all application objects, including threads, and it is very easy to access this Application state from a stateless web service. Isn't there any similar functionality in J2EE? And if not, how it should be done in Java world then?
    I guess that the Connector architecture could be the solution, but it is not documented in the tutorial.

    There's nothing in the J2EE spec that says that you have to use Web Services. Web Services by definition are stateless.
    If your requirements are that you have to use a session bean along with a Web Service, then the architecture needs to be rethought, because it doesn't seem to me that Web Services are what you want.
    That said, you can use a hybrid. You can expose some of the functionality of your application as Web Services while the remaining is implemented in a classic J2EE type framework that is stateful.
    I would also think that you could store your application state via entity beans. You could save and load them when the web service is accessed. An entity bean doesn't require a database... just some form of persistence (could be an XML file for instance).
    You need to decide which components of J2EE make sense when and where.

  • How to access application module from ActionForm Execute?

    I've got a very simple ADF/UIX/Struts application where I'm trying to create a simple Login function. I have a /loginAction data action pointing to a login.uix page forward. The login.uix page has a <struts:form> on it with a user and a password field. There is a LoginBean with the corresponding get/set values. I have an ADF model created with a boolean login(String username, String password) function exposed as a client method.
    Eventually, when I have this basic part working, then I'll actually be using an ActionForward mapping to dispatch to different home pages, based on the particular login account (the name of the forward will be stored in the authentication table).
    I've tried overriding Execute(), since that is where you can return the appropriate ActionForward mapping, but that does not have a DataActionContext passed in -- so I can't get to the application module.
    I've also looked at processComponentEvents, but that doesn't have any ActionForward results nor a way to pass back ActionErrors (in case the login fails).
    How do I call my login client method when a user has entered a username/password and pressed the Submit button?

    Here is another solution as provided by Oracle Support in response to a TAR that I opened:
    I had described my need to access a login() function defined in my Application Module, returning true/false if the login succeeds/fails. Here is the reply, posted with permission:
    I have gotten the following information back from one of the development folks pertaining to the question you asked.
    His suggestions are as follows:
    1) Expose the method as a client method on the App module
    2) On the pageflow create a new DataAction
    3) Drag and drop the logon method from the AppModule operations node and drop it onto the new data Action
    3) Edit the set-property values that are created in the Struts metadata for this new DataAction to use the correct expressions to get the logon info to pass to the middle tier.
    e.g.
    <action path="/authenticateUser" className="oracle.adf.controller.struts.actions.DataActionMapping" type="AuthenticateUserAction" name="DataForm"
    unknown="false">
    <set-property property="modelReference" value="authenticateUserUIModel"/>
    <set-property property="methodName" value="authenticateUserUIModel.authenticateUser"/>
    <set-property property="resultLocation" value="${requestScope.methodResult}"/>
    <set-property property="numParams" value="2"/>
    <set-property property="paramNames[0]" value="${param.logonUsername}"/>
    <set-property property="paramNames[1]" value="${param.logonPassword}"/>
    <forward name="fail" path="/logon.do"/>
    <forward name="success" path="/menu.do"/>
    </action>
    So in this case the values of the logonUsername and logonPassword fields in the form that submitted to this DataAction are passed as the two parameters that my authenticateUser method on the AppModule requires.
    I have also overriden the data action class to customise the findForward() method to route the user depending on if the method call worked or not.
    And here's the code for the customized FindForward in the DataAction:
    protected void findForward(DataActionContext actionContext) throws Exception
    HttpServletRequest request = actionContext.getHttpServletRequest();
    HttpSession session = request.getSession();
    String target = "fail";
    //Get the result of the Model Method call
    JUCtrlActionBinding method = actionContext.getCustomMethod();
    boolean successfulLogon = ((Boolean)method.getResult()).booleanValue();
    if (!successfulLogon)
    // If the logon fails we need to do the following
    // 1. Increament the counter once this exceeds 3 any logon will fail
    // 2. Create an error message to display on the logon screen
    // note this is a non specific error to prevent hackers from
    // knowing that they at least got the username right or from
    // knowing that there is a Max attempts value if they are trying
    // an automated attack
    Integer attempts = (Integer)session.getAttribute("logonAttempts");
    int intAttempts = 0;
    if (attempts != null)
    intAttempts = attempts.intValue();
    session.setAttribute("logonAttempts", new Integer(++intAttempts));
    //The error message comes out of the ApplicationResources.properties file.
    actionContext.getActionErrors().add("general",new ActionError("logon.error.logonFailed"));
    this.saveErrors(actionContext.getHttpServletRequest(),
    actionContext.getActionErrors());
    else
    //If connection was OK do we need to save the username in a cookie?
    String remember = (String)request.getParameter("logonRemember");
    int cookieLife = 0; //Expire
    if ( remember != null && remember.length()>0 )
    cookieLife = 2592000;
    String name = (String)request.getParameter("logonUsername");
    Cookie userCookie = new Cookie("CARA_USER_COOKIE",name);
    userCookie.setMaxAge(cookieLife);
    actionContext.getHttpServletResponse().addCookie(userCookie);
    target = "success";
    actionContext.setActionForward(target);
    I hope this helps anyone looking to implement something similar. It also illustrates the "preferred" way of executing a client method and working with the result.

  • Access Application Services from Web Dynpro DC

    Hi Experts,
    We created a CAF DC which has an application service called ClientAppService, with a method findClientsById. We also created another DC, a Web Dynpro DC, which makes use of the model generated by the CAF DC. We have programmatic access to the application service through
    ClientAppServiceProxy.findClientsById()
    , but when running the DC which makes this call we receive the following error:
    com.sap.caf.rt.exception.CAFBaseRuntimeException: Query with name findClientsById does not exist
    We've managed to call Application Services before, but that was when the Web Dynpro was in the same DC as the CAF services. Any ideas on how to fix this?
    Thanks,
    JP

    Hi Smith,
    One of the possible reasons of this error is may be your CAF project is not properly deployed in the Server in which you have deployed your WebDynpro project. So during the execution of the WebDynpro project while it tries to invoke this findby from the Application Service of your CAF project it fails to find a match. May be by mistake you have deployed your CAF Application Service first and added the findBy method later. So if your properly deploy your total CAF project in the same server in which you have deployed your WebDynpro project it may resolve your problem.
    Thanks and Regards
    Avijit

  • Accessing application methods from EL

    Hi all,
    I do not consider myself a newbie but I wonder sometimes when I can't solve these problem; Tomcat can be such a bugger to configure, especially when they change the schemas on every release.
    Anyway. I have a couple custom tags in my header.jspf file. I use the <c:import> action to include it in all documents on that virtual host.
    This is how I originally achieve this task:
    <c:import url="http://home.localhost/templates/header.jspf">
         <c:param name="newsData" value="http://home.localhost/news/news_2004-06-27.xml" />
         <c:param name="menuData" value="<%= application.getRealPath("WEB-INF/home-menu.xml") %>" />
    </c:import>Now I have decided to make everything xHTML compliant i.e. I no longer want to use and can not use <% ... %> scriptlet tags any more.
    I do not know however, how to call methods such as application.getRealPath(...) from, EL for example?
    How can I accomplish this?
    I'm hoping for something like:
    <c:import url="http://home.localhost/templates/header.jspf">
         <c:param name="newsData" value="http://home.localhost/news/news_2004-06-27.xml" />
         <c:param name="menuData" value="${application.getRealPath("WEB-INF/home-menu.xml")}" />
    </c:import>I think instead of using application I have to use servletContext, but I do not know if a attribute key/value exists that represents the servlet-path.
    Any and all help appreciates.
    Kind Regards,
    Darren Bishop

    Hey evnafets,
    Thanks for your comback.
    I had actually exhaustively tried everything, including your suggestion
    ${pageContext.servletContext.realPath}I solved it in the end with the following:
    <jsp:scriptlet>
         pageContext.setAttribute("menuData", application.getRealPath("WEB-INF/home-menu.xml"));
    </jsp:scriptlet>
    <c:import url="http://home.localhost/templates/header.jspf">
         <c:param name="newsData" value="http://home.localhost/news/news_2004-06-27.xml" />
         <c:param name="menuData" value="${menuData}" />
    </c:import>I previously did not know that JSP scripting syntax had been changed to XML elements. It works fine but I do not like it at all... effectively Java code still remains in the page which I am not happy about; wanted clean XML code, I suppose with my definition of clean not beingthe above.
    I am familiar with JSTL functions, but I can be quite stubborn if it seems that the functionality should already exist; why does the application/servletContext not have an attribute REAL_PATH or something. Then you can concatenate anything you want on the end.
    Again, thanksfor reply.
    Regards,
    Darren B

  • Set and access application items

    Hi,
    How can I set and access the values of application items from package? is't recommended to access application items from procedure?
    thanks,

    Hi,
    in PL/SQL functions or procedures regardless if they are packaged or not:
    set procedure: APEX_UTIL.SET_SESSION_STATE('MY_ITEM','myvalue');
    get function: V('MY_ITEM')
    Regards Garry

  • How to access form objects from different class?

    Hello, I am new to java and i started with netbeans 6 beta,
    when i create java form application from template i get 2 classes one ends with APP and one with VIEW,
    i put for example jTextField1 with the form designer to the form and i can manipulate it's contents easily from within it's class (let's say it is MyAppView).
    Question>
    How can i access jTextField1 value from different class that i created in the same project?
    please help. and sorry for such newbie question.
    Thanks Mike

    hmm now it says
    non static variable jTree1 can not be referenced from static context
    My code in ClasWithFormObjects is
    public static void setTreeModel (DefaultMutableTreeNode treemodel){
    jTree1.setModel(new DefaultTreeModel(treemodel));
    and in Class2 it is
    ClasWithFormObjects.setTreeModel(model);

  • BSP Application Class Restart

    Hi,
    I have an BSP Application with one main controller (main.do) and two sub-controllers (control_1.do and control_2.do).
    If I enter directly in the bsp application it works, but if I'm inside of this application and if I want start a new session with the same BSP application (using an href javascript link). The state of the actual bsp application is restarted to the new application.
    ex:
    1) APP A (I entered)
    2) Inside o APP A I click in href to call again the APP A  (I Will get an APP B) but with a new session/instance (using the window.open with the sap-sessioncmd=open)
    3) The APP A (is stopped)
    4) The APP B (is started but I loosed the previous BSP application).
    The question is, It is possible get new sessions (using window.open)from the same BSP application?How? Every time a call a window.open(A) the caller bsp session is lost.
    Best Regards,
    Ricardo Soares

    You have to remember that BSP evolved over several releases.  In 6.10 BSP released with no support for MVC - just the Application class. The application class was simply the way to share values between views and store them between requests in stateful applications.  It doesn't support any data binding.  In 6.20 BSP began to support MVC with the introduction of controller classes and model classes.  You data bind UI elements directly to model attributes only.  There is no concept of context.
    WD is completely different in that you only data bind UI element to the a context. The MVC structure is much cleaner because the view layout never has visibility to the model (regardless of what you consider the model). 
    Over time the assistance class has become the defacto standard for models in WDA, because unlike WDJ there is no direct model object.  It originally was intended mostly as a way of having text elements for WDA components.  However it is still perfectly acceptible to use service calls (proxy objects, function modules, class methods) as your model. I personally prefer to always wrap calls to my service object up in an assistance class for clear design.

  • Class not Found when accessing Proxy class from backing bean in VC.

    Hi All,
    I'm attempting to access a class of a webservice(generated as a proxy) within my ADF application and invoke the method within a backing bean of the View Controller(bean scope : backing bean). The proxy has generated an ObjectFactory class among other classes. When I access this Object factory class from within the backing bean, the application throws a Class not found error.
    I don't know where the error lies since I've declared the View Controller of the ADF application dependent on the Proxy and I've imported the class and accessing it within a backing bean. How would you suggest I approach resolveing this.
    JDev : 1.1.1.4
    Thank you.
    Regards
    PP.

    Hello Arun,
    Thank you for suggesting a Data control, but my requirement isn't to drag and drop the method as a button. It's more of a behind the scnes updating data via a database adapter requirement.
    I've resolved the issue. turns out, my deployment archive didn't include the proxy.jpr. Once included it works likea charm.
    Thanks
    PP.

Maybe you are looking for

  • I am sick to my stomach. I just wiped my wife's iphone...and lost everything.

    My wife has an iPhone 4.  I brought it to the Mac Store a few weeks back and they hooked it up to my computer and copied her files to my harddrive.  They told me that it would be the same to plug it into HER Macbook and copy her files over. Today, wh

  • User Profile created to block the UD, if RR is not done.

    Hi Gurus, For Inspection Type Z10,the UD to be blocked,if Result Recording is not carried out. ie if open charac. exist, System should block the UD. I have created a user status coping SAP Std. STATUS PROFILE - QM_L_003 AND NAMED AS "QM_UD_BK". Syste

  • Deploying MDM  content in PI 7.1..

    Hello, I have a requirement to deploy MDM content in PI 7.1 server through ESR. But when I try to login into ESR with j2ee_admin or PISUPER user I get the below pasted error. The j2ee_admin and PISUPER users are also not able to login into RWB which

  • ICloud add-in is not showing in outlook

    iCloud add-in is not showing in outlook after I installed iCloud control panel. I don't see the refresh button in outlook so my contacts are not syncing. I'm using win 7 ultimate with outlook 2007. I even tried with outlook 2010 and iCloud would not

  • I have downloaded Thunderbird Setup 31.3.0 but it will not run!

    My Thunderbird on this machine stopped working properly yesterday. It refused to download e-mails from my account - but it was seeing the correct number of e-mails on the mail server. It would not accept updates (it was at version 24.6 but would not