Which is more in line with MVC architecture with Struts?

Hello all
When using the MVC Model 2 architecture, the JSP's are the view, servlets the control, and the beans are the model. If we say that a control method should represent a specific use case, then in theory, you should be able to call the control method from any interface to request that a specific use case be performed, whether it be over a simple socket connection receiving bytes, or using HTTP.
However, when using jsp's/servlets, if thr servlet is the control, then it means that the interface must make the request using HTTP and contain a request/response object. But supposing you wanted to change the interface to request the same use case, but makes an http request but supplying XML (instead of several request parameters) which contains the request data, you cannot then simply use the same servlet use-case.
So what is the solution? If you write another servlet to handle the different request format (XML) it copies a lot of the control code from the other servlet which is a bit messy. Or, would it be correct to write a seperate Controller class (standard Java class), which would contain a set of related use cases, and are called by the servlet. Each use case (which would be a method call in the controller class), would take in its parameter list the exact type and data it needs to complete the use case. In this case the servlets are simply pulling data from the HttpRequest object, converting them to the correct java type to be passed to the controller class you create.
This introduces an extra layer; the servlet now sits between the request interface and control. It means that the control methods can be called from any type of interface, but is it the right way of doing things, and how would the new control objects be held in the servlet?
Please could someone give their opinion on which they think is the best way of architecting this?
Many thanks,
Shaun.

Shaun,
I'm going through the same issues as I try to build my own MVC framework. Struts is useful, but does not cover everything. If you're interested, I've found that the book "Core J2EE Patterns - Best Practices and Design Strategies" by Alur, Crupi and Malks is very helpful. It contains design patterns for all the various tiers. It does not describe a framework, just a set of patterns from which you can pick and choose.
In the example you describe, one of the applicable patterns is the "Session Facade" which is basically a high-level business interface. The goal is to hide the complexity of the entire business API from the client. The book recommends each facade to correspond to a related set of use cases. e.g. methods in one facade could include OpenAccount, CloseAccount, GetBalance etc. Implementation would be Java classes.
This facade should be independent of the request protocol and could be used for HTTP, by a Java application, by a web service etc. Usually the facade classes would be located close to the business objects to minimize network delay and traffic.
In your example, the controller servlet (Struts Action) would invoke services from the Session Facade.
You're right about this introducing an extra layer. Depending on your present and future needs, you can end up with others such as abstracting the persistence layer. The trade-off is between up-front effort and future flexibility.
You ask how to reference the new objects. In my case, the initialization servlet calls a factory class method to get references to the facades. These references are stored in an application-specific object that is added as a ServletContext attribute for use by other controller servlets.
I know this doesn't fully answer your question, but hopefully it helps a little.

Similar Messages

  • How to upload a file which has more than 999 line item  through BDC ?

    Hello Techards
    Hi to all
    Can any body tell me how to upload a file which has more than 999 line item  through BDC for traction F-02 ?
    Thanks in advance.
    Shovan

    Hello Shovan,
    You split it up to post two accounting documents with the help of a "suspense" a/c.
    Say, you have to post the following line items below:
    line 1 - dr. - GL a/c X - $1000
    line 2 - cr. - GL a/c Y - $1
    line 3 - cr. - GL a/c Y - $1
    line 1001 - cr. - GL a/c Y - $1
    You cannot post the above as a single doc in SAP (because of technical reasons), so you need to break it up into 2 documents as below:
    Doc1
    line 1 - dr - GL a/c X - $1000
    line 2 - cr - GL a/c Y - $1
    line 3 - cr - GL a/c Y - $1
    line 998 - cr - GL a/c Y - $1
    line 999 - cr - SUSPENSE a/c - $3
    Doc2
    line 1 - dr - SUSPENSE a/c - $3
    line 2 - cr - GL a/c Y - $3
    Note that there is no incorrect impact on accounting as first we credit suspense a/c by $3 and next we debit the same suspense a/c by $3 as a result the effect is nil. Similarly, we credit $997 to GL a/c Y (which is less by $3) in the first doc which is compensated by the second doc by crediting the shortfall of $3.
    Hope this helps,
    Cheers,
    Sougata.

  • HAVING A PROBLEM WHEN I PRINT A WEB PAGE WHICH IS MORE THAT ONE PAGE LONG. ONLY THE FIRST PAGE PRINTS TO SCALE...THE REMAINING PAGES PRINT OFF THE PAGE????HELP-IT IS DEFINITELY A PROBLEM WITH FIREFOX BECAUSE IT DOES NOT HAPPEN WITH SAFARI???

    Question
    HAVING A PROBLEM WHEN I PRINT A WEB PAGE WHICH IS MORE THAT ONE PAGE LONG. ONLY THE FIRST PAGE PRINTS TO SCALE...THE REMAINING PAGES PRINT OFF THE PAGE????HELP-IT IS DEFINITELY A PROBLEM WITH FIREFOX BECAUSE IT DOES NOT HAPPEN WITH SAFARI??

    Thank you for the response. I tried to fix the problem with some of the suggestions on that page, but none seem to work. I believe that is the only website that I'm having that problem on. I got to fooling with it a bit more and when I highlight the whole page and select to print the selected area, it actually prints the whole page then, but it won't do it as a default. I guess I can just do it like that from now on, but I thought there would be something in the settings that I could have changed. Thanks again for the help.

  • Collections in MVC architecture

    My question concerns the use of collections of entities in a database-access MVC architecture. An example similar to my situation would be a Corporation, which (among other attributes) has a collection of Departments, which (among other attributes) has a collection of Projects, which (among other attributes) has a collection of Employees.
    Sometimes, I may want information such as all the Employees in the corporation, which would necessarily involve retrieving all the entities from the database. Other times, I may only want the employees in a certain Department, in which case I wouldn't want to waste the time population all the Department beans with Project and Employee information.
    Basically, I'm not sure how to best go about populating Javabeans that contain other Javabeans containing other Javabeans. Obviously, when I go to retrieve a Corporation bean, I don't always want all the Departments, Projects, and Employees. However, it seems like it would be using a lot of redundant code to have one factory that returns just the Department base information (without it's Employees), one factory that returns all the Departments and their Projects (but not the Employees), one factory that returns all the Employees for a given Project (but not ALL the Projects and their Employees), and so on.
    I've read plenty of MVC tutorials (and even taken a course in it), but I've never really seen a basic situation such as this addressed. What is the best way to go at this situation? Does anyone know of any tutorials/examples that are similar to this situation?

    First let's say your post reminded me my previouse Project where i faced exactly this topic.( not a problem may say ) :)
    That's it orr94 ! No MVC related topic, says about these. this may be referenced in your experience of Programming and System Design, with the knowledge of OOP, implementing DBs, Performance issues, and so on...
    Simply i can tell you, by my experience, try to feel ( and then find ) what your system is supposed to do? and how it does that?
    In a situation when you should give many reports, collecting your information, and the main part is GIVING THE LISTS OF REPORTS, just try to load all of your data. ( here first time spends much time, but after that no time is needed for DB operations. you every time read from your objects ( makin' them Updatable )
    But if number of the times you should gather this information, is such small that it dosn't actualy needed to read more than wanted.
    So see that there is NO GENERAL ANSWER to this question. ( i found it on that project, spending a month to find any answers. )
    YOU SHOULD FIND YOUR ANSWER. try feeling your system by real-time TESTS, that would make you sure about a solution.
    P.S. Now as a tip
    Create a Database Logic Bean which all related methods go in for CRUD operations on entities, then as friends said, try puttin some flags for reading entities ( e.g in your constructors which use DB bean methods )
    and then try different approaches readin the data, see which makes sense to your system.
    As the last point, what chintat said ( A Getter() which reads the from db that lists ) is not a good solution, where each call to that getter(), where it'd be many calles, attemps to access db!!! you should read once, then getter() returns a reference ( maybe readonly ) to that list.
    I think the question is when to read, where YOU SHOUD FIND THE ANSWER. ;)
    nice post, i hope it helps. ;)
    Behrad

  • Event Handling Techniques with MVC

    Hello all,
    I have a situation where I have a model that can be thought of like a graph with many nodes and edges. I would like to create a view of this model with a customized JLabel that shows a data value for each node and edge in the model. The event handling to accomplish this has left me a bit perplexed, though. On one hand I was considering something similar to the following:
    // a dedicated listener for each label
    MyLabel mylabels[] = new MyLabel[numLabels];
    for(int i = 0; i != mylabels.length; i++){
    MyEventHandler eh = new MyEventHandler(mylabels);
    mylabel.addMouseListener(eh);
    public class MyEventHandler extends MouseAdapter{
    private MyLabel label;
    public void mouseClicked(MouseEvent e){
    label.setText(etc...);
    // at this point I would want to set the value of the point or edge
    // that this label corresponds to, not sure of the best strategy
    // here either
    etc...
    The other technique that I am considering might look similar to the following:
    // only one listener for all labels
    MyLabel mylabels[] = new MyLabel[numLabels];
    MyEventHandler eh = new MyEventHandler();
    for(int i = 0; i != mylabels.length; i++){ 
    mylabel.addMouseListener(eh);
    public class MyEventHandler extends MouseAdapter{
    public void mouseClicked(MouseEvent e){
    //call a control object in MVC architecture, for more processing
    control.update(e.getSource(), (String)input);
    etc...
    // in the control object class
    public void update(Object eventSource, String input){
    MyLabel source = (MyLabel)eventSource;
    source.setText(input);
    // the label would have some kind of index to indicate which one it is
    model.setData(source.getIndex(), input);
    I am interested in knowing any accepted/popular solutions to situations like this. Are either of my samples worth implementing? I would greatly appreciate any suggestions. Thanks.

    I would recommend creating a single listener and add it to every label added to the graph. If you're interested in events that occur outside of the labels (in the background), add a listener to the container of the labels as well.
    Unfortunately, you cannot simply add a listener to the container and get all the mouse events from the container's children because Swing's event dispatching system will only dispatch mouse events to a container if the click location was not within any of the container's children. This means that mouse listeners registered to a container will only receive mouse events within the container's background.

  • URL Link to BSP with MVC

    Hi,
    I have a BSP with MVC design.
    I assume that the URL link to the application is the URL I see when I go into the Controller page under the BSP in SE80.
    Is that correct?
    The problem is that when I take that URL and copy paste it into a web browser, I get the first view but when I click on any button, the controller class is not called.
    If I do a right click on the BSP and select the TEST option, all is working perfectly.
    Do you have any idea why this is happening or do I do something wrong?
    Thanks,
    Itay

    Hi Stefan,
    Same issue i have as well.
    My Understanding is, in NWBC desktop, if you open a non sap (eg: html) page, NWBC becomes an IE Browser.
    That means you are now out of SAP for that tab (with html page) and whenever you try to launch any SAP transaction (using the method from HTML) it will launch in a new window and ask for Login.
    May be Experts like Samuli Kaski & Melinda Ludanyi can put some light on it.
    But, I have one more solution for this which is partially working in my case. May be helpful in you case as well.
    Issue: From some SAP transaction in NWBC (say tab A), you are launching the html page (say tab B) and then want to launch another SAP transaction (Say tab C) from html.
    Solution: Embed the HTML in SAP using HTML Viewer class and launch SAP custom transaction using the interface IF_LSAPI. It will launch it in new tab as a sap transaction with your html page.
    Now if you want to launch the SAP transaction from your html page (Which is embedded in SAP custom transaction) you can use HTML Viewer class Events and you can pass parameters as well. Re use the same interface IF_LSAPI and launch it in new tab
    In my case i am facing problems as the web developer has so many things on java script and they are not working properly. He is working on it and i am hoping it will be fine.
    Regards,
    Nik

  • Black line sketch renderings printing with teal or magenta

    Aloha,
    When I print architectural drawings with my DesignJet 110 I sometime place computer generated sketch renderings in with the architectural plans which are vector line drawings.  The architectural line drawings and the sketch renders are computer generated made with ArchiCAD.  The HP 110 DesignJet prints the rendering and only the rendering with teal or magenta or a fade of both even though the rendering is black lines. The architectural line drawings on the same page print beautifully in black.  There is nothing on the page that is using any color lines.
    When I set the printer to "Only Use Black Ink" the renders come out in black but the quality of the rendering's lines is poorer than when it prints using the teal/magenta.
    I would like to get the printer to print high quality renderings with just black ink.  
    What is causing the problem?
    How can I fix the problem?
    Mahalo,
    John

    This forum is focused on consumer level products.  For the Designjet you may have better results posting in the HP Designjet forum here.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Strange Vertical lines and pixelation issues with my Powerbook screen...Hel

    I have got a problem with mt LCD screen which now permanently displays lines of "dead" pixels, but they can't be dead because they chaneg all the time. If I move a window, I get lots more, which are created by the edge of the window, like a ghosting? Does that make sense?
    I have taken a screen grab, but not sure how to feature it in these forums. Anyone got any ideas or know about this problem?
    I have had a similar problem with this and other laptops, but it has always been a temporary thing before, when I had overloaded the system or something, and I got 'ghosting' from the trailing edge of a window, but this is permanently there?

    I have now attached a monitor to the PB, and it happens on the monitor too...maybe suggesting something wrong with the graphics card or logic board, rather than the screen itself. When I type this message, I get strange red 'ghosting' lines where the cursor moves across the page.It reminds me of the 'Etch-o-sketch' game, where you draw lines, and then wipe them off. I can move a window from left to right and get these ghosting lines. When I move the window back right to left, they erase the lines to the left of the window, but I get more to the trailing right edge of the window...i.e. on the right of the screen.
    Scrolling also removes these pixels, but creates new ones elsewhere.
    Any ideas?

  • Customer/Vendor A/C with line item details and with opening and closing Bal

    Dear Sir / Madam,
    Is it possible to have a customer and / or vendor Sub-Ledger account-
    with line item details and with opening and closing balance detail
    for a particular period.?
    Regards
    Chirag Shah
    I thank for the given below thread which has solved the same problem for G/L Account
    Re: Report to get the ledger printout with opening balances

    Hello Srinujalleda,
    Thanks for your precious time.
    I tried the referred T-Code
    But this report is not showing Opening balance, closing balance detail.
    It only gives transactions during the specified posting period and total of it.
    Please guide me further in case if I need to give proper input at selection screen or elsewhere.
    Client Requires Report in a fashion
    Opening Balance as on Date
    + / -  Transactions during the period
    = Closing Balance as on date
    As that of appearing for G/L Account by S_ALR_87012311
    Thanks once again & Regards
    Chirag Shah

  • How do I create my own favorite template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to templates, which take more memory. I have a large slideshow, and need all the space I can get

    First, how do I create my own favorite theme template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to already existing themes, which take more memory. I have a large slideshow, and need all the space I can get. I just want to use a picture as my DVD cover, and then insert a slideshow. Also, when I try to burn my 8.5gb double sided slideshow, all that burns is the music. It is a large slideshow, a memorial on the life of my now deceased brother. This means a lot to me and to my family, and I am having so much trouble trying to burn it. I have gone into Project View and selected appropriately. The bar shows I have room to burn this DVD, but it does not burn.  I have burned so many DVDs in the past, but this one just will not burn. I am so confused at this point. I will say this is the first 8.5gb I have attempted to create and burn. My specs list a 7.7gb or 4.7gb as operable....but there are no 7.7gb dvds. I had to purchase 8.5gb. Help? What am I doing wrong? I have spent so much time on this, and just cannot figure it out.

    Final Cut is a separate, higher end video editor.  The pro version of iMovie.
    Give iPhoto a look at for creating the slideshow.  It's easy to assemble the photos in an album in iPhoto, put them in the order you want and then make a slideshow of them.  You can select from various themes and transitions between slides and add music from your iTunes library.
    When you have the slidshow as you want use the Export button at the bottom of the iPhoto window and export with Size = Medium or Large.
    Save the resulting Quicktime movie file in your Movies folder.
    Next, open iDVD, choose your theme and drag the QT movie file into the menu window being careful to avoid any drop zones.
    Then follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    The reason I suggest iPhoto is that I find it much easier to use than iMovie (except for the older iMovie 6 HD version).  Personal preferences showing here.

  • Issue in FF v 3.6.10: I have a page which have more than 20 link, clicking on these link opens up a popup using window.showModalDialog, for the first 20 popup opens up without any prob but for the 21st n more click it block the popup and do not open.

    Issue in FF v 3.6.10: I have a web page which have more than 20 link, clicking on each of these link opens up a pop-up using window.showModalDialog, for the first consecutive 20 popup opens up without any prob but for the 21st n more click it block the popup and do not open. This is m problem, the real user on the web page can click on more than 20 link in such a scenario it may create problem, please help

    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Shockwave Flash 9.0 r999
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    In Firefox 3.6 and later versions you need the Next-Generation Java™ Plug-In present in Java 6 U10 and later (Linux: libnpjp2.so; Windows: npjp2.dll).
    http://java.com/en/download/faq/firefox_newplugin.xml
    See also http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html

  • I updated my old mac Mini to OSX10.5 (Leopard) and installed the latest version of Firefox, only to get a message that it 'is not compatible with this architecture'. Any suggestions on how to get a superior web browser back?

    Upgraded old Mac mini (from 10.4 to 10.6) PowerPC G4 Processor, downloaded latest version of Firefox and ran installer, got a dialogue box that said 'not compatible with this architecture', now I don't have Firefox at all, and it is my preferred browser.

    Firefox '''4 versions and later do not run on a PowerPC Mac''' and require at least OS X 10.5 and an '''Intel Mac'''.
    The''' latest supported version for your os is 3.6.26''' , you can download it from:
    http://www.mozilla.org/en-US/firefox/all-older.html
    see for more info:
    [http://www.mozilla.org/en-US/firefox/3.6/system-requirements/ Firefox 3.6 System Requirements]
    [http://www.mozilla.org/en-US/firefox/10.0.1/system-requirements/ Firefox 10.0.1 System Requirements]
    [For older Macs that aren't supported in Firefox 4+ versions, if you like, try TenFourFox for PowerPC's running Mac 10.4.11 & 10.5.8]
    http://www.floodgap.com/software/tenfourfox/
    http://tenfourfox.blogspot.com/
    https://code.google.com/p/tenfourfox/wiki/PluginsNoLongerSupported
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • How to generate a single output pulse on 64 different digital out lines (PCI-6513) each with a different start time relative to an event in a main program loop.

    Long question.
    I am running a main program loop of 60 msec. At one point in the loop I create a 64 element array of delay times. At that point I need to begin outputting a predefined single pulse to each of the 64 lines on my PCI-6513. Each line outputs the pulse with a starting delay set by the "delay time" in the array.
    Each delay time is such that the pulses will be done before the next loop commands another one.
    Thank You
    Roger

    Hi,
    You have multiple ways of doing this, since there is no timing engine on the 6513 your code is going to control the output of the card, which is what we called “software timed”.  If you take a look at the example called: “Write Dig Chan.vi”, you can individually control each line.
    So to change the state of the line; since you have an array of delays time you can aid yourself with “stacked sequence structure” where in each frame you control the time it takes to go to the next frame and the data been written to the card.
    Another option is using a state machine where each state write the data you want and you can also control the time between states. For further references take a look at this article Application Design Patterns: State Machines.
    I hope it helps
    Jaime Hoffiz
    National Instruments
    Product Expert
    Digital Multimeters and LCR Meters

  • Which wireless all in one printers work best with ipad 4

    Please help me decide which wireless all in one printer works best with the ipad 4.  I am looking for better photo printing quality, but not the very best.  I am concerned mainly with being able to set up the printer using only my ipad 4 and wireless router, as I do not own a PC with a cd/rom.  I am also interested in which brand of compatible printers is less expensive to buy ink and paper for.  I would prefer a more compact unit.  Thank you in advance for any advice.

    These days I prefer Brother printers. They appear to have engineered their printers with AirPrint as well as OS X compatibility from the start, unlike certain others who appear to have included it as an afterthought.
    Brother's models are inexpensive, their ink is also inexpensive and lasts a long time, and their photo quality is at least as good as anyone else's. They have a two year warranty and lifetime free technical support with people who understand Apple.
    Read the reviews (Amazon for instance, but be sure to read user reviews on the various manufacturer's websites as well) and decide for yourself.
    Brother™ Monochrome Laser Printer and All-in-One models now support AirPrint.
    Brother™ Color Inkjet All-in-One units now support AirPrint.
    I positively detested every inkjet printer I ever had until I bought the Brother.

  • Can anyone solve this simple MVC problem with ArrayCollection

    I have very simple application trying to understand how to apply MVC without any framework. There are quite a few exemples on the net but most do not deal with complex data.
    here is my application with 4 files: MVCtest.mxml, MyController.as, MyModel.as and MyComponent.as
    first the Model MyModel.as
    package model
    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.events.IEventDispatcher;
    import mx.collections.ArrayCollection;
    [Event(name="ArrayColChanged", type="flash.events.Event")]
    [Bindable]
    public class MyModel extends EventDispatcher
      private static var instance:MyModel;
      public static const ARRAYCOL_CHANGED:String = "ArrayColChanged";
      private var _myArrayCol:ArrayCollection;
      public function MyModel(target:IEventDispatcher=null)
       super(target);
       instance = this;
      public static function getInstance():MyModel
       if(instance == null)
        instance = new MyModel();
       return instance;
      public function get myArrayCol():ArrayCollection
       return _myArrayCol;
      public function set myArrayCol(value:ArrayCollection):void
       _myArrayCol = new ArrayCollection(value.source);
       dispatchEvent(new Event(ARRAYCOL_CHANGED));
    then the controller: MyController.as
    package controller
    import components.MyComponent;
    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.events.IEventDispatcher;
    import model.MyModel;
    import mx.collections.ArrayCollection;
    import mx.controls.Alert;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.remoting.RemoteObject;
    public class MyController extends EventDispatcher
      [Bindable]
      public var view:MVCtest;
      [Bindable]
      public var componentView:MyComponent;
      private var _model:MyModel = MyModel.getInstance();
      public function MyController(target:IEventDispatcher=null)
       super(target);
       _model.addEventListener("ArrayColChanged", onArrayColChange);
      public function initialise(event:Event):void
       getData();
      public function getData():void
       var dataRO:RemoteObject = new RemoteObject;
       dataRO.endpoint = "gateway.php";
       dataRO.source = "MytestdbService";
       dataRO.destination = "MytestdbService";
       dataRO.addEventListener(ResultEvent.RESULT, dataROResultHandler);
       dataRO.addEventListener(FaultEvent.FAULT, dataROFaultHandler);
       dataRO.getAllMytestdb();   
      public function dataROResultHandler(event:ResultEvent):void
       _model.myArrayCol = new ArrayCollection((event.result).source);
      public function dataROFaultHandler(event:FaultEvent):void
       Alert.show(event.fault.toString());
      public function onArrayColChange(event:Event):void
       componentView.myDataGrid.dataProvider = _model.myArrayCol;
    This is the main application: MVCtest.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx"
          xmlns:controller="controller.*"
          xmlns:components="components.*"
          width="600" height="600"
          creationComplete="control.initialise(event)">
    <fx:Declarations>
      <controller:MyController id="control" view = "{this}"/>
    </fx:Declarations>
    <fx:Script>
      <![CDATA[
       import model.MyModel;
       import valueObjects.MyVOorDTO;
       [Bindable]
       private var _model:MyModel = MyModel.getInstance();
      ]]>
    </fx:Script>
    <s:VGroup paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
      <s:Label fontSize="20" fontWeight="bold" text="MVC Test with components"
         verticalAlign="middle"/>
      <components:MyComponent/>
    </s:VGroup>
    </s:Application>
    And this is the component: MyComponent.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
    <s:layout>
      <s:VerticalLayout paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"/>
    </s:layout>
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Label fontSize="16" fontWeight="bold" text="My Component " verticalAlign="bottom"/>
    <s:DataGrid id="myDataGrid" width="100%" height="100%" requestedRowCount="4">
      <s:columns>
       <s:ArrayList>
        <s:GridColumn dataField="mystring" headerText="String"></s:GridColumn>
        <s:GridColumn dataField="myinteger" headerText="Integer"></s:GridColumn>
        <s:GridColumn dataField="myreal" headerText="Real"></s:GridColumn>
        <s:GridColumn dataField="mydate" headerText="Date"></s:GridColumn>
       </s:ArrayList>
      </s:columns>
    </s:DataGrid>
    </s:Group>
    Here is the code to generate the database:
    CREATE DATABASE mytest;
    CREATE TABLE myTestDB
          myid INT UNSIGNED NOT NULL AUTO_INCREMENT,
          mystring CHAR(15) NOT NULL,
          myinteger INT NOT NULL,
          myreal DECIMAL(6,2) NOT NULL,
          mydate DATE NOT NULL,
          PRIMARY KEY(myid)
    ) ENGINE = InnoDB;
    INSERT INTO myTestDB (mystring, myinteger, myreal, mydate) VALUES ('Test', 123, 45.67, '2012-01-01'), ('Practice', 890, 12.34, '2012-02-01'), ('Assay', 567, 78.90, '2011-10-01'), ('Trial', 111, 22.22, '2009-09-09'), ('Experiment', 333, 44.44, '1999-04-15'), ('Challenge', 555, 66.66, '2012-12-21');
    And finally here is the PHP script.
    <?php
    class myVOorDTO
      var $_explicitType = "valueObjects.myVOorDTO";
      public $myid;
      public $mystring;
      public $myinteger;
      public $myreal;
      public $mydate;
      public function __construct()
        $this->myid = 0;
        $this->mystring = "";
        $this->myinteger = 0;
        $this->myreal = 0.0;
        $this->mydate = date("c");
    class MytestdbService
      var $username = "yourusername";
      var $password = "yourpassword";
      var $server = "yourserver";
      var $port = "yourport";
      var $databasename = "mytest";
      var $tablename = "mytestdb";
      var $connection;
      public function __construct()
        $this->connection = mysqli_connect(
        $this->server, $this->username, $this->password, $this->databasename, $this->port);
    * Returns all the rows from the table.
    * @return myVOorDTO
      public function getAllMytestdb()
        $query = "SELECT * from $this->tablename";
        $result = mysqli_query($this->connection, $query);
        $results = array();
        while ($obj = mysqli_fetch_assoc($result))
          $row = new myVOorDTO();
          $row->myid = $obj['myid'] + 0;
          $row->mystring = $obj['mystring'];
          $row->myinteger = $obj['myinteger'] + 0;
          $row->myreal = $obj['myreal'] + 0.0;
          $row->mydate = new Datetime($obj['mydate']);
          array_push($results, $row);
        return $results;
    ?>
    My understanding as to what is going on is: (1) on creation complete the application launch the initialise() function of the controller (2) this function starts the remoteObject which get the data (3) once the results arrive the resultHandler store the data into the ArrayCollection of the model ***this does not work*** (4) even if part 3 did not work, the setter of the ArrayCollection in the model send an event that it has been changed (5) the controller receive this event and assigns the ArrayCollection of the model as the dataprovider for the datagrid in the compoent.
    Of course, since the ArrayCollection is null, the application gives an error as the dataProvider for the datagrid is null.
    What is missing in this application to make it work properly? I believe this is an example that could help a lot of people.
    Even if I change the setter in the model to _myArrayCol = ObjectUtil.copy(value) as ArrayCollection; it still does not work.
    Also, it seems that the remoteObject does not return a typed object (i.e. myVOorDTO) but rather generic objects. I am usually able to make this works but in this particular application I have not managed to do it. Again what's missing?
    Thanks for any help with this!

    Calendar c = GregorianCalendar.getInstance();
    c.set(Calendar.YEAR,2000);
    System.out.println(c.getActualMaximum(Calendar.WEEK_OF_YEAR));
    c.set(Calendar.YEAR,2001);
    System.out.println(c.getActualMaximum(Calendar.WEEK_OF_YEAR));But it says that 2000 has 53 weeks and 2001 has 52.

Maybe you are looking for

  • Upgraded Qosmio X500-10T to Win 8.1: Sound drivers for 5.1 over HDMI

    Hello *brilliant* Toshiba community, I have recently upgraded my Qosmio X500-10T from 64-bit Windows 7 to 64-bit Windows 8.1. I have left Windows to download driver updates. My setup: Qosmio (HDMI) => Yamaha AV receiver (HDMI) => Samsun LCD TV. _The

  • GL Account for Spl GL Indicator 'A'

    Hi, The users are trying to enter the downpayment in a Vendor's Account using the Spl GL Indicator 'A'. However, the system gives the error message - "No special GL Account defined for acct type K sp. G/L Ind. A recon acct 486000". To resolve the iss

  • IPod Touch used until battery went flat, starts charging and now it won't stop resetting itself (Apple screen). :(

    I have an iPod Touch, fairly old (think it's 3rd gen, has no camera). I used it today until the battery went flat, tried charging it as I normally do and now it's stuck as if it's having the home and off buttons pressed all the time... It keeps reboo

  • Digital Copy of Bluray won't show up in iTunes

    I got the bluray trilogy of Jurassic Park for christmas, and each of the movies came with a digital copy i could download on itunes. So i did as the instructions told me to do, went online, entered the code, it opened up itunes for me, and let me dow

  • IBook G4 Install Disc

    Hi, I had the unfortunate circumstance of having my iBook G4's hard drive fail, unexpectedly. I replaced it easy enough. But I seem to have lost the Mac OS X install disc to reload. Can anyone tell me where in the world I can get another? I don't wan