Model controllers and Application classes in WD

Can somebody give me examples of WebDynpro components which either use the concept  of Model controllers or the concept of Application classes? Thanks.
Regards
Sukanya

HI,
Refer this thread:
Model Component
And this : model view controller
Generally the concept of Model in WDA is fullfilled by the Assistance class object instead of a separate component.
It is better from a performance point of view. You can then save your data as attributes and only put that data in contexts were needed.
Here's help on the subject:
http://help.sap.com/saphelp_nw04s/helpdata/EN/43/1f6442a3d9e72ce10000000a1550b0/content.htm
Thanx.
Saurav.
Edited by: Saurav Mago on May 2, 2009 11:06 PM

Similar Messages

  • Page Attributes and Application Class Attributes

    Hi, everyone,
    I am quite new to BSP.
    I have a question here:
    what is the difference between page attributes and application class attributes of a bsp application? As they are both global attributes, there seems to be no big difference when we use them.
    thanks a lot.
    Fan

    Hi Fan,
    a BSP application can be made up of many pages.
    A page attribute is visible only in the page it is associated with.
    Attributes of the application class are visible from every page in that application.
    Cheers
    Graham Robbo

  • Retain variables and application class attributes in a statless bsp..

    hello experts,
    i need to transform a bsp page from stateful mode to stateless but there is a link in the page and the content changes when clicked on the link. when statefull there is no problem cause i can keep the parameters in various ways but i need to find a way to retain those variables in stateless mode as well. is there any way to do this??
    replies appreciated,
    thanks..

    do you mean server side cookies using class cl_bsp_server_side_cookie didnt help. i use it in all my stateless apps without any problem. may be if you could explain the flow of app/data and show us your code using cl_bsp_server_side_cookie=>set_server_cookie we may be able to check out whats going wrong.
    Raja

  • CIF - Integration model name and APO application

    Hi Experts,
    In the CFM1 Transaction, there are 3 mandatory inputs are Model name, Logical system and APO application.
    Logical systems are customized in CFC1 transaction. I couldn't trace the model name and application creation.
    What is the transaction to customize/Create the new Model name and APO application.
    Hope this is very simple question to you and expect your soon.
    Thanks,
    Saravanan V

    Hi Somnath,
    Thanks for ur reply.
    First I saved the selection as variant. But it was not updated in the IM table.
    Then I tried to generate the model and now I can see the details when I use the F4 help.
    So, to create a integration model need to generate the variant once.
    Thanks for the confirmation.
    Thanks,
    Saravanan V

  • The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

  • MVC model in Web systems and applications

    MVC model in Web systems and applications
    Object-oriented design model is experience, MVC idea is a user interface for the original. This article discusses how the major application areas in the new Web design patterns and the use of MVC framework. The article first introduced the concept of design patterns and characteristics, and MVC architecture design concepts and analysis of the MVC framework contains several key models. Based on the characteristics of Web applications on how to use patterns and MVC framework made some design ideas.??
    1. Introduction
    1.1 design model
    Object-oriented technology and the emergence of software applications has greatly enhanced the trusted and software quality. Object-oriented programming than previous models to various programming simple and efficient, but the object-oriented design methodology than the previous design methods to complex and much more skill, a good design should be both on the issue of gender, but also to take full account of the problems and needs sufficient interoperability. In the past 10 years, people in the object-oriented technology and the practical application of research to explore certain issues in relation to the creation of a number of good solutions, the so-called object-oriented design patterns. Object-oriented technology is one of the purposes of enhancing the software trusted, and to design model, design programmes in important positions from a deeper sense of meaning and essence embodies trusted. There are many people in the design model definition, which cited Christopher Alexander is the largest design model definition : Each design model is a tripartite rule, which expresses a contextual environment (Context), a problem and a solution. Design models generally following basic elements : model name, the purpose solution effect 1995-1998 code and related design models. There are several classifications design patterns can be divided into a model based on the purpose (Creational), structural type (Structural) and the type of behaviour (Behavioral) three. It is mainly used in the creation of a model-based object model-based structure to deal primarily with the category or combination of objects, used to describe behavior-based model is the main target for the category or how stress and how to allocate responsibilities. Design patterns can be divided into categories based on the scope and target mode model type model dealing with the relationship between the categories and sub-categories, these relations through the establishment of succession in Translation moment to be finalized, are static. Model is targeted at addressing the relationship between the moment of change these relations in the operation, more dynamic. Model features : through the experience acquired in a structured format to write down, avoid encountering the same problems on the first design, exist in different abstract level, in continuous improvement, can be trusted artificial product for the design and best practice in the world to be combined to address larger issues.
    1.2 MVC framework
    MVC was first used in a user interface Smalltalk-80 China. M representative models Model, representatives maps View V, C representatives controller Controller. MVC trusted code with the aim of increasing the rate of data reduction expressed, the data describing the operation and application coupled degrees. Also makes software Keweihuxing, restorative, expansionary, flexibility and packaging of greatly enhanced. Single-user applications are usually incident-driven user interface to the organizational structure. Staff development tool with an interface painting of a user interface interface code based on user input and then prepare to implement the corresponding moves, many interactive development environment encouraged to do so, because it emphasizes first and then a functional interface. Some software design model is the strategy that will be fixed before the code into the regular system of the final. Result is that the procedures and organizations around the user interface elements in the user interface elements of those moves, data storage, applications and functions of the code is used to indicate the way intertwined. In single-user system code structure can be so, because the system will not demand frequent changes. But for a large system such as large Web systems, or e-commerce systems to be applied. Model by incorporating data from a variety of access and control data can be separated to improve distributed system design. MVC design pattern is composed of three parts. Model is the application object, no user interface. Type in the screen showing that it represents the flow of data users. Controller user interface definition response to user input, the users responsible for the action against the Model into operation. Model View data updated to reflect the adoption of data changes.
    2. MVC design pattern,
    An MVC framework for the design of the system includes many models, but with MVC is most closely related to the following three models : Observer, Cambridge and Strategy.
    2.1 Observer models
    MVC through the use of purchase / notification form and the separation of the Model View. View to ensure that their content accurately reflected Model and state. Once Model content changes, there must be a mechanism to allow notification to the relevant Model View, View can be made relevant at the appropriate time updating of data. This design is also more general problems can be solved, the target separation, making a change to the target audience affect others, which targets those who do not know the details of the object being affected. This is described as Observer in the design model. Model type : Observer model is the object-oriented model, it is behaviour-based model. Model purposes : definition of hierarchical dependence relations between objects, or when a target value of the state change, all its dependent relationship with the object are notified and automatically updated. There are a variety of data may show a way, in different ways and may also show. When a way through a changed data, then the other should be able to show immediately that the data change and do accordingly.
    Effect :
    1. Abstract coupling. I only know that it has a target audience of some observers, the observers met each abstract Observer category simple interface, does not know their specific affiliation categories. This makes the coupling between goals and observers smallest and abstract.
    2. Support radio communications. Needless to notify designated observers goals, how to deal with the observer informed decisions.
    3. Possible accidents updated. We update logic, avoiding mistakes updated.
    2.2 Faculty model
    MVC is an important feature of View can nest. Nest can be used for any type of combination of local maps available, but also management of type nest. This thinking reflects the type and mix of components will be equal treatment design. This object-oriented design ideas in the area of Cambridge has been described as a design model. Model types : Cambridge model is the object-oriented model, it is also the structure type model. Model purpose : to target portfolio into tree structures to express "part-whole" level structure. Prepared for the use and combination of individual target audiences with the use of consistency.
    Effect :
    1. Definition of a target portfolio includes simple objects and the structure of the category level. Simple objects may be complex combinations of objects, and can be targeted portfolio mix. This customer-code used in the target areas can use simple combinations target.
    2. Simplify customer-code. Needless to know their customers - a mix of target audiences is a simple target or can use these items in a consistent manner.
    3. Easier to add new types of components. New components can easily be changed to a combination of customer-targeted codes.
    2.3 Strategy model
    Another important characteristic is the MVC can not change the View of changes View response to user input. This often requires a change in response to the logic of the system is very important. MVC to respond to the logic involved in the Controller. Controller of a category level structure could easily change to the original Controller appropriate, a new Controller. View Controller son used to achieve a specific example of such a response strategy. To achieve different response strategy, as long as examples of the use of different types of replacement will Controller. Also in the running time by changing the View Controller for users to change View of response strategies. This View-Controller relationship was described as an example of Strategy design pattern. Model types : Strategy model is the object-oriented model, it is behaviour-based model. Model purposes : definition of a series of algorithms, and their packaging, and ensure that they can replace each other, making algorithms can independently use its customer-change.
    Effect :
    1. Strategy category levels for Context definition of the relevant algorithms can be trusted or behaviour.
    2. Alternative methods of succession. If the direct successor Context, with different acts will be added Context act, the realization of which would algorithm mixed up with Context, Context hard to preserve and expand, but can not dynamically changing algorithms. Will be enclosed in a separate Strategy category algorithms to enable algorithm independent Context change easily cut over expansion.
    3. Can provide the same acts different date.
    4. Strategy-must understand what customers between different.
    5. Context and Strategy communications between costs.
    6. An increase in the number of targets.
    3. MVC in Web application system
    Now some of the distributed systems such as Web-based B2B e-commerce system, suitable for use MVC framework. Through analysis from the perspective of high-level applications can be a target divided into three categories. Category is shown for the target audience consists of a group of commercial rules and data, there is a category that is receiving requests to control commercial target to complete the request. These applications often need to change is shown, such as web style, color, but also need to demonstrate the contents of the display. And the business rules and data to be relatively stable. Therefore, said that the frequent need to change the View objects that the business rules and data model to be relatively stable target, and that the control of the Controller is the most stable. When the system is usually issued after the View objects by artists, designers or HTML/JSP system managers to manage. Controller target applications development personnel from the development and implementation of rules for commercial and business development personnel from the target data, database managers and experts in the field of common completed. Show in Web?? or customers - control logic can be Servlet or JSP, dynamically generated Html. Generally used Servlet better than using JSP. JSP will be better with the Html code of separate codes for page designers and developers of separation efficiency. Servlet and JSP can complete all complete functions, actually JSP eventually converted into a Servlet. And control of the target system exists in every level, the coordination of cross-layer moves. Contain business rules and data objects exist in the EJB layer (EJB-centred model) or Web?? (Web-centred model).
    3.1 View in the Web application system
    View of the system shows that it fully exist in Web??. General by JSP, Java Bean and Custom Tag. JSP can generate dynamic web content using Java Custom Tag easier Bean, but it can show the logic of packaging, and more conducive to modular trusted. Some well-designed in a number of JSP Custom Tag can even be used in different system duplication. Model for control of JSP and Java Bean objects. JSP through Java Bean objects to retrieve the data model, the Model and Controller object is responsible for updating the data on Java Bean. In general, can we devise all possible screen that users can see all the elements of the system. Based on these elements, to identify the public part of passive components and dynamics. Can consider the use of templates means to separate the content generated JSP public, also need to change their generation Html or JSP from a JSP templates to dynamically introduce these different parts (include methods). Another issue to consider is screen option, when dealing with End users request template automatically available to show that the concern that users must know what is the screen components. So can consider all screens on the definition of a centralized document, such as a document or text document java. Taking into account the possibility of changes in future document definition screens, the best use of text documents such as a XML document, so future changes to the recompilation. According to the URL and user input parameters to shine upon the results of a screen, of course, likely to be made on the basis of the outcome of the implementation of actions to choose different results screen. Therefore, the need for a request for matching resources with document (XML), if a URL request several different results, it must specify in the document need to control the flow (a controller object), as well as the corresponding screen different flows.
    3.2 Model in the Web application system
    Model objects represent business rules and business data exist in EJB layer and Web??. In J2EE norms, the system needs some data stored in the database, such as user account information (account model), the company's data (company model), some not recorded in the database. If a user browsing the current catalogue (catalog model), the contents of his shopping (shopping cart model). Which one of these models exist in the data according to their life cycle and scope to decide. In Web?? a HttpSession and ServletContext and Java Bean objects to store data in the EJB layer is a data storage and logic EJB to. Web?? the Java Bean objects stored in the model layer model of the EJB object data copy. Because there are many different EJB tier model targets, so Web?? through a ModelManager to control the EJB layer object model in ModelManger background model can be used for packaging methods. In the EJB layer and the rules have all the data into EJB model is inappropriate. If the database can visit the Dao object model into objects. Dao can be encapsulated and the specific details of the database in the world, if we can write a different table, a number of databases, or even multiple databases. If the orders can be a model for OrderDAO, it may have to deal with Order table, table and OrderItemLines OrderStatus table. Value can also consider the use of targets. Value can be a target of securing long-range targets, because every time the remote object attributes could be a long-range redeployment process will consume network resources. EJB objects in the distance can be used instead target. In the distance, one-time items to be targeted instead of the value of all attributes.
    3.3 Controller in Web application system
    Coordination with the Model View Controller object to the request of users into the system to identify incidents. In Web?? generally a MainServlet (or Main.jsp), and receiving all requests, it can use screen flow management devices (ScreenFlowManger) decided next screen. There is a general request processors RequestProcessor contains all requests are needed to be done to deal with logic, such as the request translated into system events (RequestToEvent). Acting processors usually also includes a request for ClientControlWebImpl, it is logical to deal with the EJB layer in Web?? Acting. In EJB layer, a layer for EJB tier Web ClientController provide the CD visit. Another StateMachine used to create and delete ejb handle Web?? sent to the incident. Controller Another important function is synchronous View and Model data. ModelManger contained in a ModelUpdateManger, it puts events into a Model System assembly that all the needs of synchronous Model, and then notify Listeners do synchronous operation.
    4. Concluding remarks
    In recent years, with the Internet technology development and the emergence of new business models, the Web is based on a large number of applications. On how to design these systems architecture, and gradually there has been some convergence of opinion, the most important point is that its structure should be rational in the open. Demand than ever faster development of technology and design concepts, systems for the future, the cost of upgrading the smallest, research software systems architecture still very useful and necessary.

    Bravo. And your point is?

  • Sharing an object/class bewteen servlets and applications

    Hi there,
    I wish to know how to share a class/object between all
    types of other classes, be they applications or servlets, but I encounter the following problem.
    Basically, if I instantiate the common class using, say a servlet, then when I try to gain a handle on the instance of that class from an application, the application creates a new(or it's own) instance. Similarly, if I instantiate first within an application.
    How do I prevent this from happening?
    The actual class files for both the application and servlets are all the same.
    Appreciate the help,
    Fintan.

    I am actually implementing the singleton pattern in
    this common class.ok, that clarifies the issue a bit...
    The RMI route seems to me to be a bit too much work > as a solution to a very simple concept.actually, it's really not a simple concept. What you really want isn't just an application singleton, where there is one instance in the application/servlet JVM. What you really want is more along the lines of a universal singleton, where there is only one instance for ALL applications/servlets...
    Interestingly, if I run two java apps side by side in
    two DOS windows that each call a getInstance
    method in common singleton, both apps create their
    own instance.
    How come? Separate instances of VM?Yes, this is exactly correct. The same is true of C++ Singletons; if you start a second application it will create another instance of the Singleton because one does not yet exist in the application.
    How do I get aroun this one?Like I said, think of it as a universal singleton. Consider Verisign a universal singleton--everyone comes to them for certificates. How does this run? Well, truthfully, Verisign operates as a service, right? So you need some way of setting up a service that really holds onto the object and brokers (aha, 5 dollar word!) who has access to it, who can modify it, and who can read from it. This leads you to a few options... RMI, CORBA, or writing your own object server.
    Networking is really easy in Java, so here's another option... You can set up a server that listens for messages on a specific socket/port with whatever protocol you specify to get/set values. Have the server run on only one specific machine. Then you can have all the servlets and applications come to the machine to get the information.
    Gee, this sounds like a back-end database. =)
    If all this is too complex, maybe you need to rethink the design... do you really need to have the exact same object shared between all application/servlet instances? Or is it acceptable to just make sure they all contain the same data?
    If what you really want is a real-time data update scheme, then you probably want something like a subscribe-publish architecture where the one server publishes the origainal data. Then when a client updates the server, the server posts an update message to all the clients, who then in turn update their internal data.
    Anyway, I'm just throwing out some ideas. I'm sure you can come up with some better ones of your own since you know what your requirements are. =)
    Once again appreciate the help!I hope it actually was. =)
    --David

  • 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

  • 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.

  • Xcode, how do you take an app from an idea to a data model, data structure, or class structure?

    Hey everyone!
    I'm a beginner xcoder and computer engineering sophomore and have literally spent every hour of the past few weeks reading as much as I possibly can about becoming a developer.
    I've found plenty of documentation, and guides on how to do very specific things in xcode and objective-C but am still looking for more information on one topic; how do you decide which data models/structures/controllers etc to use?
    I mean, you personally. I've been looking for a resource on this and have not been able to find one. I just finished Apple's iOS Developers Guide and they mention "choosing a data model" but do not describe them in much detail.
    The following is what is provided in the guide:
    ● Choose a basic approach for your data model:
    ● Existing data model code—If you already have data model code written in a C-based language, you
    can integrate that code directly into your iOS apps. Because iOS apps are written in Objective-C, they
    work just fine with code written in other C-based languages. Of course, there is also benefit to writing
    an Objective-C wrapper for any non Objective-C code.
    ● Custom objects data model—A custom object typically combines some simple data (strings, numbers,
    dates, URLs, and so on) with the business logic needed to manage that data and ensure its consistency.
    Custom objects can store a combination of scalar values and pointers to other objects. For example,
    the Foundation framework defines classes for many simple data types and for storing collections of
    other objects. These classes make it much easier to define your own custom objects.
    ● Structured data model—If your data is highly structured—that is, it lends itself to storage in a
    database—use Core Data (or SQLite) to store the data. Core Data provides a simple object-oriented
    model for managing your structured data. It also provides built-in support for some advanced features
    like undo and iCloud. (SQLite files cannot be used in conjunction with iCloud.)
    ● Decide whether you need support for documents:
    The job of a document is to manage your app’s in-memory data model objects and coordinate the storage
    of that data in a corresponding file (or set of files) on disk. Documents normally connote files that the user
    created but apps can use documents to manage non user facing files too. One big advantage of using
    documents is that the UIDocument class makes interacting with iCloud and the local file system much
    simpler. For apps that use Core Data to store their content, the UIManagedDocument class provides similar
    support.
    I suppose my question boils down to, how do you decide which structures to use? If you can provide an example of an app idea and how its implemented that would be very helpful and much appreciated!
    For example, to implement the idea of an app which allows users to progress through levels of knowledge of a certain subject and rewarding them with badges and such (this is not an actual app just a whim) how would one model that?
    Thanks in advance for all your help!!!

    SgtChevelle wrote:
    how do you decide which structures to use?
    Trial and error.
    I wish I had a better answer for you, but that pretty much encapsulates it. There is some, but not much, good wisdom out there, but it takes a significant amount of experience to be able to recognize it. The software development community if currently afflicted with a case of copy-and-paste-itis. And the prognosis is poor.
    The solution is to be brutal to yourself and others. Focus on what you need and ignore everything else. Remember that other people have their own needs and methods and they might not be applicable to you. Apple, for example, can hire thousands of programmers, set them to coding for six months, pick the best results, and have the end-users spend their own time and monety to test it. If you don't have Apple's resources and power, think twice about adopting Apple's approach. And I am talking from a macro to a micro perspective. Apple's sample and boilerplate code is just junk. Don't assume you can't do better. You can.
    Unfortunately, all this takes time and practice. You can read popular books, but never assume that anyone knows more than you do. Maybe they do and maybe they don't. It takes time to figure that out. Just do your best, ignore the naysayers, and doubt other people even more than you doubt yourself.

  • What is the correct way to model an abstract base class/table?

    I tried to model an abstract base class/table. For the parent table I used the "Forward Engineer Strategy" "Table per child" and I set on each child table the "Super Type" to the corresponding parent table. I did this for two parent tables and five child tables. This is the result:
    https://lh5.googleusercontent.com/-1La98ulWOZg/T_2Hyock5-I/AAAAAAAAAoI/00qn5ukJCpI/s678/2012-07-11
    But when I engineer the logical model into a physical model, the result is not as expected:
    https://lh5.googleusercontent.com/-YfF_ocUa8bY/T_2H_YSqkyI/AAAAAAAAAoc/rNEYRnTFzU4/s617/2012-07-11
    First the parent table "obj" should not be created. The table is correctly omitted, but the primary key of the parent table gets created. For me this is not logical. And even worse the primary key gets created twice with the same name, which results in a DDL generation error.
    And second the primary key of the "attr" table does not get merged into the primary key of the child tables. This results into two individual unique constraints although I have expected to create only one with two attributes.
    Is this a bug or is there another way to model this example correctly?

    chriswalsh wrote:
    The installer for Silverlight installed it as a seperate volume displayed on the desktop...
    Likely that's not the app itself. When you download most Mac software, you are downloading a .dmg file (a disk image) - opening that (which may happen automatically) mounts a disk image on your desktop, and then you drag the app from that disk image to your Applications folder (or an installer runs).
    After copying/installing the app, you Eject the disk image, then delete the .dmg file (from your Downloads folder, probably).

  • Creating subcontroller in application class function

    i am using a certain subcontroller quite frequenly in my BSP-app. I wrote this function to craete the subcontroller:
    method create_sc.
      data lorv_subcontroller type ref to zcl_bla.
      lorv_subcontroller ?= create_controller( controller_name = 'bla.do'                     controller_id   = iv_controller_id ).
      lorv_subcontroller->init( ... ).
    endmethod.
    at the moment, this function is in another (super-)controller-class. since i need the subcontroller on multiple pages, i wanted to move the function to my application class or to a static class. however, this doesn't work, probably because i can only call create_controller() from within a controller-class.
    what can I do? isn't it possible to make this function available to other controller-classes?
    could i maybe pass a reference to a subcontroller-variable (here lorv_subcontroller ) to the method?

    Is there a concept of multiple inheritance (I don't think so!!!) ?
    Let me just paraphrase, what you have said :
    ycl_maincontroller inherits cl_bsp_controller2
    and all other controllers inherit ycl_maincontroller.
    But if you make ycl_maincontroller abstract, you can't implement the method create_sc, right!!!
    But your idea is a very novel one. THanks for sharing it with us.
    Regards,
    Subramanian V.

  • 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.

  • 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

  • JSP extending application class?

    Greetings,
              I'm in the midst of porting some servlets from an implementation that
              didn't use jsp at all to a MVC type model.
              For some quick and dirty output, I wanted to define a couple jsp files
              that extended a app BaseServlet class (frame and menu functions included
              on this servlet) so that
              I could do stuff like this
              </body>
              <% setSideMenu(<array of Menu structures from session>); %>
              ... other html
              where setSideMenu was one of the functions this jsp inherited from my
              BaseServlet class.
              Unfortunately, the JSP compiled, but whenever I try to use it, the
              client browser sits waiting for output that never comes.
              Now, before I go off and debug this with lots of printlns, is there
              some easy explaination for why WLS would do this (did I break the JSP
              implementation by extending a class that was not weblogic.xxx?)
              If I remove the "page extends..." directive, the jsp returns after
              compilation ok.
              Thanks In Advance,
              Brian Homrich
              Chicago Illinois
              

      There is no  such thing as a javafx  class.  It is a regular  java class.  The Aapplication class is  the entry
    point  for JavaFX application.  You have to extend the Application class to create Javafx  application .

Maybe you are looking for