MVC: Tell a controller class which controller called it

I have to controller pages (page1.do and page2.do) that both shall use the same controller class (CL_CTR).
Can I tell in DO_REQUEST of the controller class whether page1.do or page2.do called the controller class?

Hi Daniel,
To call page1(2).do's from do_request you first put the following in DO_INIT.
data:  page1details type ref to cl_bsp_controller2.
page1details ?= create_controller( controller_name = 'page1details.do'
                                    controller_id = 'subcntlr1_id' ).
similarly you should do the same for page2.
Then in DO_REQUEST.
data: subcontroller1 type ref to cl_bsp_controller2.
subcontroller1 ?= get_controller( controller_id = 'subcntlr1_id' ).
  call_controller( subcontroller1 ).
I hope this helps.
If it doesn't work let me know.
Regards
Amit
Message was edited by: amit kumar

Similar Messages

  • Checking textbox through java class which is called  in jsp

    I have created a text box in html and if the string entered by user is a alphabet it will not show any message ,else it should display a error message..These checking validations of textbox is done in java and called in jsp;
    a.html
    <font size="4">Enter the search keyword:</font><input type="text" name="key" ><br>
    and also submit button is there which goes to main.jsp
    main.jsp
    <%@page import="gaveshan.checking;"%>
    <%
    checking ch=new checking();
    String trans=request.getParameter("key");
    out.println(ch.ParseClean(trans));
    session.setAttribute( "trans", trans );
    %>
    checking.java
    package gaveshan;
    import java.awt.event.*;
    public class checking
    {  public String ParseClean(String str)
    if(str.length()==100||str.length()==0)
    return "Enter String Properly";
    for(int i=0;i<str.length();i++)
    if(!(str.charAt(i)>65&&str.charAt(i)<122))
    return "Enter String Properly";
    it is not givng any message when user enters the input in textbox
    it is not showing any error

    Using javascript.
    var lwr = 'abcdefghijklmnopqrstuvwxyz';
    var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    function isValid(parm) {
    for (i=0; i<parm.length; i++) {
    if (val.indexOf(parm.charAt(i),0) == -1) return false;
    return true;
    }- vignesh

  • URGENT controller class and XML file

    Hi there,
    I understand that oapagecontext.getParameter("FieldID") returns the field of XML. So for example in my xml i had this:
    <oa:messageTextInput id="AActiveTo" dataType="DATE" viewName="RoleAdminVO" prompt="Active To" viewAttr="ActiveTo" readOnly="${oa.RoleAdminVO.SecuredFlag}" columns="15"/>
    And on the front end I typed in "25-Aug-2006". My oapagecontext.getParameter("AActiveTo") should return "25-Aug-2005".
    However is this only true if I put oapagecontext.getParameter within my processFormRequest of the controller class which the XML is pointing to?
    Cheers

    Or you can apply a XSLT transform as per http://blogs.msdn.com/b/mattm/archive/2007/12/15/xml-source-making-things-easier-with-xslt.aspx
    Arthur My Blog

  • Cannot locate custom controller class after applying OIE.K  patch.

    Hi,
    I am trying to search all the region level personalizations(on Update Allocations Page in iExpenses while creating Expense Reports) to find out where our custom controller class is being called(it was personalized at site level). But no luck until now.
    Nevertheless, we were able to locate our custom controller class in an instance where the OIE.K oracle patch was not applied. Seems like after applying this patch, the seeded region names are changed too. Our custom code also works but cannot figure out where our CO is being called.
    Any suggestions please?
    Thanks,
    Swati.

    Guys,
    Using "About the Page" link on UpdateExpenseAllocationsPG, I found SplitCriteriaTblCO controller class instead of UpdateKffCO class, that was extended to HumUpdateKffCO custom class.
    Our custom code is still intact even though we do not find our custom CO. Probably we have to look elsewhere to find it, no idea!.
    I just need to know how to remove our iExpense extension. In order to remove the iExpense extensions in the instance where the OIE.K was not applied, we just removed the personalization at site level, where the controller HumUpdateKffCO was called and that took care of it.
    --Swati.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get the function name in controller class

    Hi experts ,
    I am new to the OAF framework.
    i have created the two functions and bot he the function have the same controller class .i want to capture the function name or function id in the controller class.
    can you please let me know how to get the function id or function name in the controller class.

    Hi apurba,
    Thanks for the quick reply.
    i am trying to get the function name from the FunctionSecurity class,
    However in FunctionSecurity class there is no such method defined as getFunctionName();
    my requirement is ,i have two functions functionA and functionB defined.
    both the function has the same controller class.in controller class ,i need to get the function name ,based on the function name
    i will redirect the page to respective page.
    looking forward for you response.
    appreciate your help
    Thanks,
    KT

  • JSP does not call the right method in controller class

    Hi all,
    I have a jsp file which loads a page at this address: http://localhost:8080/dir/list/
    I've added two checkboxes to the page; user can check both checkboxes, only one or none. Following is code I have in jsp file:
    <form class="checkboxForm">
    <c:choose>                                                                                                         
    <c:when test='${newItems==true}'>
    <input id="newItems" type="checkbox" value="#" name="newItems" class="checkbox2" checked="checked" /><strong> New Businesses   </strong>                                                                 
    </c:when>
    <c:otherwise>
    <input id="newItems" type="checkbox" value="#" name="newItems" class="checkbox2"/><strong> New Businesses   </strong>
    </c:otherwise>
    </c:choose>
    <c:choose>                                                                                                         
    <c:when test='${rejectedItems==true}'>
    <input id="rejectedItems" type="checkbox" value="#" name="rejectedItems" class="checkbox3" checked="checked"/><strong> Rejected Businesses   </strong>                                                                 
    </c:when>
    <c:otherwise>
    <input id="rejectedItems" type="checkbox" value="#" name="rejectedItems" class="checkbox3"/><strong> Rejected Businesses   </strong>
    </c:otherwise>
    </c:choose>
    <a href="#" onclick="apply();">
    <button name="apply" class="btn-primary" value="Apply" tabindex="4">Apply</button>
    </a>
    </form>
    <script type="text/javascript">
    function apply(){
         var newItems = document.getElementById("newItems").checked;
         var rejectedItems = document.getElementById("rejectedItems").checked;
         alert("Inside apply() method.");
         alert("newItems= " + newItems + ", rejectedItems: " + rejectedItems);     
         window.location = "<c:url value='/list/'/>" + newItems + "/" + rejectedItems;
         alert("window.location= " + window.location);
         alert("Add extra delay!");
         return false;
    </script>This is my Controller class:
    // Method1: this method gets called when the user loads the page for the first time.
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public String list(Model model, HttpServletRequest request) {          
              System.out.println("Controller: method1: Passing through...");
              model.addAttribute("newItems", Boolean.TRUE);
              model.addAttribute("rejectedItems", Boolean.TRUE);
              // Does other things.
    // Method3: this method gets called when user checks/unchecks one of the checkboxes and clicks on Apply button.
    @RequestMapping(value="/list/{newItems}/{rejectedItems}", method = RequestMethod.GET)
    public String list(@PathVariable Boolean newItems, @PathVariable Boolean rejectedItems, Model model, HttpServletRequest request) {          
              System.out.println("Controller: method3: Passing through...");
              model.addAttribute("newItems", newItems);
              model.addAttribute("rejectedItems", rejectedItems);
    // Does other things.
         }The way my jsp code is written now, it calls the correct method and displays the correct url. When page loads for the first time, it calls method1 and the url is:
    http://localhost:8080/dir/list
    When the user checks/unchecks one or both checkboxes and clicks on apply button, method3 is called and this url is displayed:
    If both checkboxes are checked which both booleans are set to true:
    http://localhost:8080/dir/list/true/true
    Everything is fine... however, if I comment these two lines at the end of JavaScript apply() function,
    alert("window.location= " + window.location);
    alert("Add extra delay!");Then method3 will never gets called; only method1 gets called and I see this url:
    http://localhost:8080/url/list//?newItems=%23&rejectedItems=%23&apply=Apply
    I do not know why it gets confused bet. method1 and method3 and cannot pick the right method?
    I tried to use the POST method instead, but the page goes directly to our internal error page and it never reaches the method I wrote in my controller for POST:
    I don't really know what I'm doing wrong? Any help is greatly appraciated.
    Edited by: ronitt on Dec 13, 2011 2:35 PM

    I changed the <form> in the jsp to div and its working fine. I do not need to have comments in JavaScript funcion() anymore. I don't know why that made the difference though? According to:
    http://www.w3schools.com/tags/tag_form.asp
    The <form> tag is used to create an HTML form for user input.
    The <form> element can contain one or more of the following form elements:
    <input>
    <textarea>
    <button>
    <select>
    <option>
    <optgroup>
    <fieldset>
    <label>
    An HTML form is used to pass data to a server.
    I do have <button> and also send the data - the value of checkboxes - to server. So I think it should also work with <form>.
    Please let me know if you have any idea. Thanks.

  • BSP Controller Class Enhancement - calling problem while execution

    Hi all,
    We are having a requirement in the EREC-Publication.
    We have to insert 2 Droop-down fields on screen providing the F4 help for them.
    BSP is modified to add the required fields.
    Also, the Controller class methods are enhanced so that the given F4 list table is populated.
    Here the issue is, when we call the BSP application a fresh and go to the required page, F4 help gets populated and the list is displayed. This means that the Enhancement is also being called. - Confirmed after inserting a break-point.
    Then if i navigate to "Previous page" or "Initial page" using the link that is generated by the SAP Standard. Then when i come back to the same page again. the Enhancement for filling the F4 help list is not called and as a result the F4 help remains empty...
    Is there any solution for the same i am not able to figure out what is exactly going wrong?
    Thanks and Regards,
    Kunjal Patel

    Hi Sharmila,
    The BSP Application in concern is a SAP Standard and hence, we need to enhance the same.
    What you say is correct that we need to do it in the DoInit method. However, as far as possible Modification of SAP Standard code should be avoided. For the same, we have used the Implicit Enhancement point to enhance the required Method of the class.
    This Enhancement is not called every time the class method is called. Hence, the worry.
    Any suggestions?
    Thanks and Regards,
    Kunjal Patel

  • MVC controller class too big, refactoring suggestions please

    Currently I have an application using the MVC pattern. The controller class contains implements methods from 6 different interfaces. There will be 1 controller class per user role and there is a lot of common code between the users. I can't pull up common code to the controllers' super class because there is very little code that is common to all 4 controllers, however most of the code is common to 3 or 2 controllers.
    Can anyone think of a good way to avoid duplicating code without creating a lot of extraneous classes and complicating the structure? After thinking about several solutions, I'm starting to lean towards just copy pasting the code into three classes and not caring that I'm duplicating code.
    Yours forever in sickness and in health,
    Mr. Kayaman the Magnificent

    Without seeing your design in greater detail I can only make some fairly generic recommendations.
    1. More smaller modular pieces is easier to work with than fewer large monolithic pieces.
    2. Consider what a controller class is supposed to do. At its foundational level, it's a traffic cop. It directs traffic. As such, migrate functionality to model components where it belongs.
    3. Just at a glance, it sounds like it might be a candidate for an AbstractFactory pattern.
    4. In general terms I am opposed to copy/pasting code in any form. That's not to say it's never done, just that I'm resistant to that as a course of action.
    Just my thoughts on the subject.
    Currently I have an application using the MVC pattern.
    The controller class contains implements methods from
    6 different interfaces. There will be 1 controller
    class per user role and there is a lot of common code
    between the users. I can't pull up common code to the
    controllers' super class because there is very little
    code that is common to all 4 controllers, however most
    of the code is common to 3 or 2 controllers.
    Can anyone think of a good way to avoid duplicating
    code without creating a lot of extraneous classes and
    complicating the structure? After thinking about
    several solutions, I'm starting to lean towards just
    copy pasting the code into three classes and not
    caring that I'm duplicating code.
    Yours forever in sickness and in health,
    Mr. Kayaman the Magnificent

  • Calling an action from a different controller class with an input form

    I have a Controller class declared as follows...
    public class Controller extends PageFlowController
    This class is not in a package. Inside this Controller class, I have a form class that is used as input for an Action method.
    public static class OrderDetailsForm extends FormData
    I also have another Controller class that exists in a subdirectory (and consequently has a package name)..
    package createOrder;
    class CreateOrderController extends PageFlowController
    From an Action within this Controller class, I want to forward to an Action in the first Controller class. I need to get access to the OrderDetailsForm class to do this, but I don't know how to declare a variable of the OrderDetailsForm class. I tried to do this...
    Controller.OrderDetailsForm myForm;
    But the compiler doesn't accept this. My question is what is the class name that I should be specifying to create an instance of OrderDetailsForm that lives in the Controller class that doesn't live inside a package?

    Do you know how to create an object of a class in some other class? The code you wrote seems you dont have basic sense of what is a object and class. Where did you create the object of your People class in your animal class? Create the object of people class within the animal class like:
    public class Animals {
        People people;
        public Televoting() {
        public void showAnimals() {
            people = new People(); // This is called the object creation by calling the constructor of the People 
                                              // class. Now you can access all the methods and variables of your people
                                              // class through the people object.
            System.out.println(people.peoples[0] + " is not an animal, but a person.") // Notice the difference.
    }I am sorry to say that you are not a good student and learner.
    Shan.

  • Musings: MVC Front Controller/Command and Controller Strategy

    Hi,
    I am currently taking my first shot at implementing the Front Controller pattern, the Command and Controller Strategy flavor, in Java. When applying the pattern, my chosen point of focus is achieving as much isolation as possible of Client-specific implementation details from the rest of the framework (Web-based framework Clients, Swing-based framework Clients, queueing-based framework Clients, etc.) However, I am running into a lot of (apparent?) inconsistencies when it comes to CCS discussions "out there", so I have a feeling that perhaps I have misunderstood the Front Controller/Command and Controller Strategy pattern. Maybe the MVC gurus out there would have some thoughts on the matter.
    My issues:
    1.) Some CCS discussions seem to assign View presentation (sometimes called "dispatch", or "rendering", or "forwarding"?) to an ApplicationController. It seems puzzling to me, since only a concrete FrontController should include any knowledge of a concrete View structure. Shouldn't only a FrontController perform a logical-to-physical resource mapping, thus encapsulating knowledge whether a particular View is a separate, stand-alone Web page or a compound, argument-driven Swing object, and how to "present it" (by either redirecting to a Web page, or bringing a particular Swing object into the foreground)?
    2.) Some CCS discussions seem to introduce Client-specific implementation details at the ApplicationController level, for example "HTTP requests" or "HTTP responses". It seems puzzling to me, since I feel that every part of the framework, except for a concrete FrontController, should be completely independent of the nature of a Client making a request. Instead, I created a generic Request object w/arguments and have a concrete FrontController translate any client-specific details into such a generic Request, before delegating to an ApplicationController.
    3.) In the light of the (2.) above, I am not sure what constitutes a "response" from an ApplicationController back to a FrontController. It seems to me that the only universal "response" is a LogicalViewEnumeration: what View to present once a command has been completed, in many cases a "don't care", or a "show the requestor", or a "show a home page" (not every request has to result in changing a View). Well, perhaps a LogicalViewEnumeration as well as possible View arguments (?).
    4.) In the light of the (3.) above, I suspect that any failures in Request delegation, or Command execution, should be perhaps propagated back to a FrontController by exceptions only, since, say, a WebFrontController might want to show a click-through error page, when a SwingFrontController might prefer to show an error dialog box, a LogicalErrorViewEnumeration might not make sense at all in the context of a particular Client, for example a queueing Client.
    5.) In the light of the (4.) above, there is the question of an appropriate Request interface (into an ApplicationController), an appropriate Response interface (back into a FrontController), as well as an appropriate ViewArguments interface (into a FrontController and later into a View). The problem with generic Requests is that they can be created with nonsensical argument combinations, so shouldn't Requests be abstract and force proper arguments in concrete subclasses, through explicit constructors (in a sense, degenerate Commands)? The problem with Responses and ViewArguments is that... well, I have not found any formal discussion anywhere as to what those should look like. In most samples I have encountered, Responses include Client-specific implementation details, as mentioned in (2.), above.
    6.) Some CCS discussions seem to introduce a Flow Manager at the ApplicationController level. It seems puzzling to me, since the whole point of the Command and Controller Strategy flavor seems to be centralization of business logic execution within self-contained Command objects. Shouldn't Requests get associated with Handlers (objects capable of actually carrying out Requests) and transformed into Commands inside an ApplicationController, thus Commands themselves return appropriate LogicalViewEnumeration back to an ApplicationController, back to a FrontController? Let's consider a ShowMyShippingAddress request coming into the framework: unless such a Request is eventually treated as a Command returning a particular LogicalViewEnumeration, it is suddenly a Flow Manager "acting" as a business logic driver. I guess the question here is: except for a few special cases handled by a particular ApplicationController (authentication, error conditions, default behavior, etc.), should flow management be considered stand-alone, or always delegated to Commands?
    7.) Some CCS discussions seem to include an extra Request argument that specifies an ApplicationController to use (Request.Action="create", Request.Controller="account", Request.Username="me-me-me"), instead of using a Router inside of a FrontController to resolve to a particular ApplicationController through a generic action (Request.Action="createAccount", Request.Username="me-me-me"). I am not sure about the reason for such a design decision: why should a Client or a FrontController be allowed to concern itself with an implementation-level structure of the framework? Wouldn't any framework state -dependent ApplicationController resolution issues be best handled inside a Router, used by a FrontController to resolve [obtain] an appropriate ApplicationController, thus preventing Clients from ever forcing the framework into a possibly inconsistent behavior?
    Any comments appreciated...
    Thanks,
    Gary

    gniemcew wrote:
    1.) Some CCS discussions seem to assign View presentation (sometimes called "dispatch", or "rendering", or "forwarding"?) to an ApplicationController. It seems puzzling to me, since only a concrete FrontController should include any knowledge of a concrete View structure. Shouldn't only a FrontController perform a logical-to-physical resource mapping, thus encapsulating knowledge whether a particular View is a separate, stand-alone Web page or a compound, argument-driven Swing object, and how to "present it" (by either redirecting to a Web page, or bringing a particular Swing object into the foreground)?It is hard to tell without reading the actual discussion, but my guess is that the posters were either conflating or being loose with the distinction between a FrontController and an ApplicationController. The former is (normally) intimately tied to the actual view being used (HTTP, Swing, etc.) whereas the ApplicationController typically is not. Both are involved in dispatch and event processing. The former normally renders a view whereas the latter does not.
    gniemcew wrote:
    2.) Some CCS discussions seem to introduce Client-specific implementation details at the ApplicationController level, for example "HTTP requests" or "HTTP responses". It seems puzzling to me, since I feel that every part of the framework, except for a concrete FrontController, should be completely independent of the nature of a Client making a request. Instead, I created a generic Request object w/arguments and have a concrete FrontController translate any client-specific details into such a generic Request, before delegating to an ApplicationController.Generic is fine. However, you can become generic to the point where your Request and Response interfaces are only acting as "marker" interfaces (think of java.io.Serializable). Writing a truly generic controller is possible, but personally, I have never found the effort justified.
    gniemcew wrote:
    3.) In the light of the (2.) above, I am not sure what constitutes a "response" from an ApplicationController back to a FrontController. It seems to me that the only universal "response" is a LogicalViewEnumeration: what View to present once a command has been completed, in many cases a "don't care", or a "show the requestor", or a "show a home page" (not every request has to result in changing a View). Well, perhaps a LogicalViewEnumeration as well as possible View arguments (?).A given service (if you ascribe to SOA) should be the fundamental unit in your architectural design. A good application controller would be responsible for determining how to dispatch a given Command. Whether a Command pattern is used or whether service methods are invoked directly from your FrontController, the ApplicationController should enforce common service aspects. These include authentication, authorization, auditing, orchestration, validation, logging, error handling, just to name a few.
    The ApplicationController should ideally offload these aspects from a given service. The service would indicate how the aspects are to be applied (e.g., strong authentication required, x role required, fetching of existing process state, etc.) This allows services to be developed more quickly and to have these critical aforementioned aspects developed and tested centrally.
    Your FrontController, in contrast, is responsible for transforming whatever input it is designed to receive (HTTP form data posts, XML-RPC, etc.) and ensure that it honors the contract(s) that the ApplicationController establishes. There are no cut-and-dry decisions though about when a given piece of functionality should be ApplicationController or FrontController. Take error handling. Should I emit just a generic ServiceException or allow the FrontController to decide what to do with a more concrete checked exception? (The FrontController, in any case, should present the error to the user in a manner dictated by the protocol it serves).
    gniemcew wrote:
    4.) In the light of the (3.) above, I suspect that any failures in Request delegation, or Command execution, should be perhaps propagated back to a FrontController by exceptions only, since, say, a WebFrontController might want to show a click-through error page, when a SwingFrontController might prefer to show an error dialog box, a LogicalErrorViewEnumeration might not make sense at all in the context of a particular Client, for example a queueing Client.See above. Yes. However, the ApplicationController could easily 'hide' details about the failure. For example, any number of exceptions being mapped to a generic DataAccessException or even more abstractly to a ServiceFailureException. The ApplicationController could indicate whether the failure was recoverable and/or populate information necessary to speed up production support (e.g., mapping exceptions to error codes and/or providing a primary key in an error audit log table for support to reference). A given FrontController would present that information to the user in the method that makes sense (e.g., error dialog for Swing, error page for HTML, etc.)
    gniemcew wrote:
    5.) In the light of the (4.) above, there is the question of an appropriate Request interface (into an ApplicationController), an appropriate Response interface (back into a FrontController), as well as an appropriate ViewArguments interface (into a FrontController and later into a View). The problem with generic Requests is that they can be created with nonsensical argument combinations, so shouldn't Requests be abstract and force proper arguments in concrete subclasses, through explicit constructors (in a sense, degenerate Commands)? The problem with Responses and ViewArguments is that... well, I have not found any formal discussion anywhere as to what those should look like. In most samples I have encountered, Responses include Client-specific implementation details, as mentioned in (2.), above.See comment on marker interfaces above. Nothing, however, stops you from requiring a certain sub-type in a given service method. You can still pass in the interface and validate the proper type by an assert statement (after all, in the vast majority of situations, the proper service method should get the proper instance of a given Request object). IMO, the FrontController would create the Command instance which would be passed to the ApplicationController which would dispatch and invoke the proper service method. A model response would be received by the FrontController which would then render the appropriate view.
    gniemcew wrote:
    6.) Some CCS discussions seem to introduce a Flow Manager at the ApplicationController level. It seems puzzling to me, since the whole point of the Command and Controller Strategy flavor seems to be centralization of business logic execution within self-contained Command objects. Shouldn't Requests get associated with Handlers (objects capable of actually carrying out Requests) and transformed into Commands inside an ApplicationController, thus Commands themselves return appropriate LogicalViewEnumeration back to an ApplicationController, back to a FrontController? Let's consider a ShowMyShippingAddress request coming into the framework: unless such a Request is eventually treated as a Command returning a particular LogicalViewEnumeration, it is suddenly a Flow Manager "acting" as a business logic driver. I guess the question here is: except for a few special cases handled by a particular ApplicationController (authentication, error conditions, default behavior, etc.), should flow management be considered stand-alone, or always delegated to Commands?There are distinct kinds of flow management. For example, orchestration (or BPM) is properly at either the service or ApplicationController layers. However, determining which view to display is properly at the FrontController layer. The ApplicationController should receive a Command (with a populate Request) and return that Command (with a populated Response). Both the Request and Response are fundamentally model classes (within MVC). The FrontController is responsible for populating the Request and/or Command and rendering the Response and/or Command. Generic error handling is usually centralized for both controllers.
    gniemcew wrote:
    7.) Some CCS discussions seem to include an extra Request argument that specifies an ApplicationController to use (Request.Action="create", Request.Controller="account", Request.Username="me-me-me"), instead of using a Router inside of a FrontController to resolve to a particular ApplicationController through a generic action (Request.Action="createAccount", Request.Username="me-me-me"). I am not sure about the reason for such a design decision: why should a Client or a FrontController be allowed to concern itself with an implementation-level structure of the framework? Wouldn't any framework state -dependent ApplicationController resolution issues be best handled inside a Router, used by a FrontController to resolve [obtain] an appropriate ApplicationController, thus preventing Clients from ever forcing the framework into a possibly inconsistent behavior?I am not 100% sure of what you are getting at here. However, it seems to be the method by which commands are dispatched. They are in effect allowing a FrontController to dictate which of n ApplicationControllers should receive the request. If we allow a FrontController to directly invoke a service method, then the ApplicationController is simply a centralized framework that should always be invoked for each service method (enforced via AOP or some other mechanism). If there is a single, concrete ApplicationController which handles dispatch, then all FrontControllers communicate directly with that instance. It is really just a design decision (probably based on your comfort level with concepts like AOP that allow the ApplicationController to exist solely behind the scenes).
    I might have totally missed your questions, but those are my thoughts on a Monday. Best of luck.
    - Saish

  • How to retrieve content from DAO Class and process in Controller Class?

    Hello
    This is for the experts.
    What is the best approach to passing a large set of data from Class A to Class B? I have a DAO Class that connects to a database to retrieve data. I tried saving the data in a collection (map) and passing the collection to Class B. The problem here is that the data is may be too large for a collection without increasing the heap size, it could cause out of memory exception. Instead I'd like to pass the data (row by row) on to the "Controller" Class where which will process each row. I am not sure how to do this without using a collection or some sort. Some tips will be much appreciated.
    Note: MVC Rules dictates that Controller cannot call the DAO Class directly, it has to go through the Model which talks directly with the DAO Class.
    Thanks
    Edited by: 875864 on 30-Oct-2011 15:05

    875864 wrote:
    Hello
    This is for the experts.
    What is the best approach to passing a large set of data from Class A to Class B? I have a DAO Class that connects to a database to retrieve data. I tried saving the data in a collection (map) and passing the collection to Class B. The problem here is that the data is may be too large for a collection without increasing the heap size, it could cause out of memory exception. Instead I'd like to pass the data (row by row) on to the "Controller" Class where which will process each row. I am not sure how to do this without using a collection or some sort. Some tips will be much appreciated.
    Note: MVC Rules dictates that Controller cannot call the DAO Class directly, it has to go through the Model which talks directly with the DAO Class.
    Thanks
    Edited by: 875864 on 30-Oct-2011 15:05if its a large set of data, and is fetched from DB and you are sure that it is too large and chances of getting out of memory exception then why you are passing it over request.
    If the data is fetched based on some filter criteria, then just pass the filter criteria from class A to class B, and fetch the data from DB based on the filter criteria in class B.

  • How to get the parent window in sub-child controller class in javafx?

    how to get the parent window in sub-child controller class in javafx?

    You can get the window in which a node is contained with
    Window window = node.getScene().getWindow();Depending when this is invoked, you might want to check the Scene is not null before calling getWindow().
    If the window is a stage that is owned by another window, you can get the "parent" or "owner" window with
    Window owner = null ;
    if (window instanceof Stage) {
      Stage stage = (Stage) window ;
      owner = stage.getOwner();
    }

  • How to Find Controller class of  BSP application for particular Iview

    Hi  All,
    Any one please  help me  to find a Controlller class of BSP for an  I view.
    http://Host Name :Port No/sap/bc/gui/sap/its/wosm-cr-->this is for sap retail,
    My requirement  is to change some source code in that particular iview.
    i goine with SE80 Tcode
    with package called WOSM>ITS service>Topic 90-->which contain Mime Objects,Html Templates.
    but i dint find any
    Point will be given!!!

    Hi All,
    My question is where should i find Controller class ?
    i gone with Tcode  SE80>packages>WOST>ITS service>WOSM>Topic90>which contain Mime Objects,HTML Templates.
    i dint find any controller class.
    regards
    Naresh

  • New controller classes for Web IC views

    Hi
    Could anyone help out with the following:-
    I 'inherited' a customer's Web IC implementation to support recently.  The system hasn't been properly documented, I'm new to Web IC and they've just applied support packages to the system which has caused some problems.
    The specific issue is as follows:-
    I search for, identify and confirm a business partner.
    I call up view IHistResult (via Interaction History from the NavBar) - this was copied from the standard CRM_IC application and has a Z controller associated with it.  There is an XML controller replacement in place to call this view.
    When the view is called, I get a syntax error - CX_SY_MOVE_CAST_ERROR.  The cast that occurs is from a variable referencing CL_BSP_CONTROLLER to my Z class - which does have a relationship to CL_BSP_CONTROLLER through super classes.
    If I make the controller class the SAP standard class (CL_CRM_IC_IHISTRESULT_IMPL) then everything is fine.  I created a new, clean Z class with CL_CRM_IC_IHISTRESULT_IMPL as the super class, no redefinitions, no changes and assigned this to the view.  Then I get the syntax error in the view.
    I don't see what the problem with casting to my Z class can be - it's a subclass of CL_CRM_IC_IHISTRESULT_IMPL with absolutely no changes. 
    If anyone could suggest any ideas or solutions I'd be grateful.
    Thanks
    Ben

    Found my own solution to this one.  Hadn't updated the .do file - only the .htm.
    Sorry for any time wasted.

  • Controller Class: Search functionality.

    Hello,
    Here is a snapshot of the Controller class what NetBeans have created by default which interacts with the entity class. I need to add a search functionality to this bean which a JSF search form can utilize. Can anyone help me out to add without breaking it's structure.
    public class ProductController {
        private Product product = null;
        private List<Product> products = null;
        @Resource
        private UserTransaction utx = null;
        @PersistenceUnit(unitName = "ExApp")
        private EntityManagerFactory emf = null;
        public EntityManager getEntityManager() {
            return emf.createEntityManager();
        public int batchSize = 15;
        private int firstItem = 0;
        private int itemCount = -1;
        public SelectItem[] getProductsAvailableSelectMany() {
            return getProductsAvailable(false);
        public SelectItem[] getProductsAvailableSelectOne() {
            return getProductsAvailable(true);
        private SelectItem[] getProductsAvailable(boolean one) {
            List<Product> allProducts = getProducts(true);
            int size = one ? allProducts.size() + 1 : allProducts.size();
            SelectItem[] items = new SelectItem[size];
            int i = 0;
            if (one) {
                items[0] = new SelectItem("", "---");
                i++;
            for (Product x : allProducts) {
                items[i++] = new SelectItem(x, x.toString());
            return items;
        public Product getProduct() {
            if (product == null) {
                product = getProductFromRequest();
            if (product == null) {
                product = new Product();
            return product;
        public String listSetup() {
            reset(true);
            return "product_list";
        public String createSetup() {
            reset(false);
            product = new Product();
            return "product_create";
        public String searchSetup() {
            reset(false);
            product = new Product();
            return "product_search";
        public String create() {
            EntityManager em = getEntityManager();
            try {
                utx.begin();
                em.persist(product);
                utx.commit();
                addSuccessMessage("Product was successfully created.");
            } catch (Exception ex) {
                try {
                    if (findProduct(product.getId()) != null) {
                        addErrorMessage("Product " + product + " already exists.");
                    } else {
                        ensureAddErrorMessage(ex, "A persistence error occurred.");
                    utx.rollback();
                } catch (Exception e) {
                    ensureAddErrorMessage(e, "An error occurred attempting to roll back the transaction.");
                return null;
            } finally {
                em.close();
            return listSetup();
        public String detailSetup() {
            return scalarSetup("product_detail");
        public String editSetup() {
            return scalarSetup("product_edit");
        private String scalarSetup(String destination) {
            reset(false);
            product = getProductFromRequest();
            if (product == null) {
                String requestProductString = getRequestParameter("jsfcrud.currentProduct");
                addErrorMessage("The product with id " + requestProductString + " no longer exists.");
                String relatedControllerOutcome = relatedControllerOutcome();
                if (relatedControllerOutcome != null) {
                    return relatedControllerOutcome;
                return listSetup();
            return destination;
      private Product getProductFromRequest() {
            String theId = getRequestParameter("jsfcrud.currentProduct");
            return (Product) new ProductConverter().getAsObject(FacesContext.getCurrentInstance(), null, theId);
        private String getRequestParameter(String key) {
            return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(key);
        public List<Product> getProducts() {
            if (products == null) {
                products = getProducts(false);
            return products;
        public List<Product> getProducts(boolean all) {
            EntityManager em = getEntityManager();
            try {
                Query q = em.createQuery("select object(o) from Product as o");
                if (!all) {
                    q.setMaxResults(batchSize);
                    q.setFirstResult(getFirstItem());
                return q.getResultList();
            } finally {
                em.close();
        private void ensureAddErrorMessage(Exception ex, String defaultMsg) {
            String msg = ex.getLocalizedMessage();
            if (msg != null && msg.length() > 0) {
                addErrorMessage(msg);
            } else {
                addErrorMessage(defaultMsg);
        public static void addErrorMessage(String msg) {
            FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
            FacesContext.getCurrentInstance().addMessage(null, facesMsg);
        public static void addSuccessMessage(String msg) {
            FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
            FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg);
        public Product findProduct(Integer id) {
            EntityManager em = getEntityManager();
            try {
                Product o = (Product) em.find(Product.class, id);
                return o;
            } finally {
                em.close();
        public int getItemCount() {
            if (itemCount == -1) {
                EntityManager em = getEntityManager();
                try {
                    itemCount = ((Long) em.createQuery("select count(o) from Product as o").getSingleResult()).intValue();
                } finally {
                    em.close();
            return itemCount;
        public int getFirstItem() {
            getItemCount();
            if (firstItem >= itemCount) {
                if (itemCount == 0) {
                    firstItem = 0;
                } else {
                    int zeroBasedItemCount = itemCount - 1;
                    double pageDouble = zeroBasedItemCount / batchSize;
                    int page = (int) Math.floor(pageDouble);
                    firstItem = page * batchSize;
            return firstItem;
        public int getLastItem() {
            getFirstItem();
            return firstItem + batchSize > itemCount ? itemCount : firstItem + batchSize;
        public int getBatchSize() {
            return batchSize;
        public String next() {
            reset(false);
            getFirstItem();
            if (firstItem + batchSize < itemCount) {
                firstItem += batchSize;
            return "product_list";
        public String prev() {
            reset(false);
            getFirstItem();
            firstItem -= batchSize;
            if (firstItem < 0) {
                firstItem = 0;
            return "product_list";
        private String relatedControllerOutcome() {
            String relatedControllerString = getRequestParameter("jsfcrud.relatedController");
            String relatedControllerTypeString = getRequestParameter("jsfcrud.relatedControllerType");
            if (relatedControllerString != null && relatedControllerTypeString != null) {
                FacesContext context = FacesContext.getCurrentInstance();
                Object relatedController = context.getApplication().getELResolver().getValue(context.getELContext(), null, relatedControllerString);
                try {
                    Class<?> relatedControllerType = Class.forName(relatedControllerTypeString);
                    Method detailSetupMethod = relatedControllerType.getMethod("detailSetup");
                    return (String) detailSetupMethod.invoke(relatedController);
                } catch (ClassNotFoundException e) {
                    throw new FacesException(e);
                } catch (NoSuchMethodException e) {
                    throw new FacesException(e);
                } catch (IllegalAccessException e) {
                    throw new FacesException(e);
                } catch (InvocationTargetException e) {
                    throw new FacesException(e);
            return null;
        private void reset(boolean resetFirstItem) {
            product = null;
            products = null;
            itemCount = -1;
            if (resetFirstItem) {
                firstItem = 0;
        private Map<Object, String> asString = null;
        public Map<Object, String> getAsString() {
            if (asString == null) {
                asString = new HashMap<Object, String>() {
                    @Override
                    public String get(Object key) {
                        if (key instanceof Object[]) {
                            Object[] keyAsArray = (Object[]) key;
                            if (keyAsArray.length == 0) {
                                return "(No Items)";
                            StringBuffer sb = new StringBuffer();
                            for (int i = 0; i < keyAsArray.length; i++) {
                                if (i > 0) {
                                    sb.append("<br />");
                                sb.append(keyAsArray);
    return sb.toString();
    return new ProductConverter().getAsString(FacesContext.getCurrentInstance(), null, (Product) key);
    return asString;
    Thank you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Can you tell us what "not working" means? Can you give us some more detail to try and narrow down the problem? Also you say the search works on your local machine. Have you tried running the help from the generated / published location yourself?

Maybe you are looking for

  • How to make my program case - in sensitive?

    Hi, Iam writing a SELECT query in report for retrieving the address number by giving address details like street, city and post code.But my program is case sensitive such that if the user inputs either in Upper Case or Lower Case, it will not work. F

  • Tabular model process-took 4 HOURS instead of normal 10 minutes

    There must be some sort of log I can view or review to get a better look inside the process? When I refreshed my development project (which is using the same server for workspace) it takes less than 10 or 15 minutes. Then I deployed it to my server a

  • How can I edit the right-click context menu?

    I seem to have two entries for every Adobe product when I right-click a file and choose "Open With..." Is there a way to either clean it out automatically, or fix this myself? ...Mike

  • Comments link not showing

    My comments link isn't showing on "Amanda's Blog" where it says "read more... 0 comments"? It does show in iWeb, but not on the published website? It's working fine on "Jon's Blog"?

  • "Graphic Problem Has Occurred"  What does this Mean?

    I have frequently received the above message - usually the application freezes.  What should I do???