Business Logic in Taghandler methods???

Hi,
Is there any reason that the business operation(logic) in a TagHandler class should take place in a doEndTag() for TagSupport class and doAfterBody() in BodyTagSupport class?
If so, why it can't be done in the doStartTag() and doInitBody() ?
Thanks,
JavaCrazyLover

Hi,
Is there any reason that the business operation(logic) in a TagHandler class should take place in a doEndTag() for TagSupport class and doAfterBody() in BodyTagSupport class?
If so, why it can't be done in the doStartTag() and doInitBody() ?
Thanks,
JavaCrazyLover

Similar Messages

  • Changing method signature according to the new business logic

    Dear java community,
    Recently I'm confronted with one issue and I want to know your opinion about this.
    ISSUE DESCRIPTION:
    In one of my business tier class I had method register user:
    public RegistrationStatus registerUser(User user, RegistrationType type, boolean confirmationRequired) throws MyBusinessException;According to new business rules I need to add 2 arguments to this methods (boolean isCustomBank and String customBankName).
    All arguments in method are mandatory and I need them in registration process. It is also possible that in future it would be needed to pass more arguments to registerUser method (according to changes in business logic).
    POSSIBLE SOLUTIONS:
    A) Create userContext (as map) and collect there some arguments that needed in registration process (it would be used not only in this method, so it also would contain some other arguments not needed in registration). Signature of this method would look like this:
    public RegistrationStatus registerUser(User user, RegistrationType type, Map userContext) throws MyBusinessException;Invocation would look like this:
    Map userContext = new HashMap();
    userContext.put(UserCostants.CONFIRMATION_REQUIRED, form.isConfirmationRequired());
    userContext.put(UserCostants.CUSTOM_BANK, form.isCustomBank());
    userContext.put(UserCostants. CUSTOM_BANK_NAME, form.getCustomBankName);
    myRegistrationService.registerUser(form.getUser, form.getRegistrationType(), userContext);And UserCostants:
    public interface UserCostants {
       String CUSTOM_BANK = "customBank";     
       // other constants
    }B) Create userContext (as class � wrapper of map from previous solution) and collect there some arguments that needed in registration process (it would be used not only in this method, so it also would contain some other arguments not needed in registration). Signature of this method would look like this:
    public RegistrationStatus registerUser(User user, RegistrationType type, UserContext ctx) throws MyBusinessException;Wrapper class:
    public class UserContext {
       Map userContext = new HashMap();
       public Boolean isCustomBank() { return (Boolean) userContext.get("customBank"); }
       public void setCustomBank(Boolean customBank) { userContext.put("customBank", customBank);}
       // other get and set metods
    }C) Create value object UserRegistrationData that would hold data ONLY for user registration method. Example of the signature:
    public RegistrationStatus registerUser(User user, RegistrationType type, UserRegistrationData registrationData) throws MyBusinessException;And value object class:
    public class UserRegistrationData {
       public boolean customBank;
       public boolean confirmationRequired;
       public String customBankName;
       public boolean isCustomBank() { return this.customBank; }
       public void setCustomBank(boolean customBank) { this.customBank = customBank;}
       // other get and set metods
    }D) Just add new arguments to method's signature:
    public RegistrationStatus registerUser(User user, RegistrationType type, Boolean confirmationRequired,
                                           boolean isCustomBank, String customBankName) throws MyBusinessException;E) your solution....
    QUESTIONS:
    I don't tell you my opinion and pros and cons because I want to know your independent opinion.
    Which of these solutions are good and why do you think they are good?
    Which of these solutions are bad and why do you think they are bad?
    Thanks.

    Hi ,
    I thought of you overload that method and add into the Map.
    Its best solution, even we use the same scenario in my application.
    Thanks and Regards
    Maruthi.

  • Problem in creating a callable object of type Business Logic

    Hi SDN,
    I am trying to create a callable object of type Business Logic in CE.
    When I give all information and click Next, I get this error message.
    Error while loading configuration dialog: Failed to create delegate for component com.sap.caf.eu.gp.ui.co.CExpConfig. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
    Can anybody help me out with this problem.
    Regards,
    Sumangala

    Hi.
    I'm having the same problem as Senthil in NW2004s SP15 with my application service and methods not showing up in the Callable Object wizard for Composite Application Services after I choose the Endpoint.  The only application name that shows up in the wizard is caf.tc, and the only service names that show up for it are LDDataAccessor, Metadata, and PropPermissionService.
    My IDE is on one machine and the application server I deploy to is located on a different machine.  My endpoint to the remote application server looks to be correctly configured.  The Composite Application Service seems to be deployed properly as I'm able to see it and test that it works in the Web Services Navigator <http://remotehost:50000/wsnavigator/>
    My deployed application service is a remote enabled service and is also web services enabled as well.
    I'm not sure if this is relevant, but I noticed that the generated Java code does not create any remote EJB interfaces (only home and local interfaces were generated).
    Something else I noticed is that when I proceed to the External Service Configuration -> Business Entities screen <http://remotehost:50000/webdynpro/dispatcher/sap.com/cafUIconfiguration>, I only see three business entities displayed, and the following error message is displayed: "Corrupt metadata has been detected. This may prevent some objects from being displayed. Check the server log for more details."  I was unable to find anything in the instance log files.  Is the error message indicative of the problem?
    I am developing locally without a NetWeaver Development Infrastructure (NWDI) in place.
    I'm wondering if the credentials specified in the endpoint require any special roles or privileges.
    Senthil, do any of these additional descriptions apply to you as well?
    Edited by: Ric Leeds on Jun 20, 2008 4:37 PM

  • How to display values after doing some business logic in data action

    hi guys i got the same problem but iam unable to display the values..in my display page when iam trying to do some business logic in my data action class..
    can u guys help me out
    iam pasting my code which iam working here
    my struts-config.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
    <form-beans>
    <form-bean name="DataForm" type="oracle.adf.controller.struts.forms.BindingContainerActionForm"/>
    </form-beans>
    <action-mappings>
    <action path="/inputform" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataForwardAction" name="DataForm" parameter="/inputform.uix">
    <set-property property="modelReference" value="inputformUIModel"/>
    <forward name="success" path="/inputAction.do"/>
    </action>
    <action path="/inputAction" className="oracle.adf.controller.struts.actions.DataActionMapping" type="order.view.InputAction" name="DataForm">
    <set-property property="modelReference" value="displaypageUIModel"/>
    <forward name="success" path="/displaypage.do"/>
    </action>
    <action path="/displaypage" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataForwardAction" name="DataForm" parameter="/displaypage.uix">
    <set-property property="modelReference" value="displaypageUIModel"/>
    </action>
    </action-mappings>
    <message-resources parameter="order.view.ApplicationResources"/>
    </struts-config>
    my input form uix
    <?xml version="1.0" encoding="windows-1252"?>
    <page xmlns="http://xmlns.oracle.com/uix/controller"
    xmlns:ui="http://xmlns.oracle.com/uix/ui"
    xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
    xmlns:html="http://www.w3.org/TR/REC-html40"
    expressionLanguage="el">
    <content>
    <dataScope xmlns="http://xmlns.oracle.com/uix/ui">
    <provider>
    <!-- Add DataProviders (<data> elements) here -->
    </provider>
    <contents>
    <document>
    <metaContainer>
    <!-- Set the page title -->
    <head title=""/>
    </metaContainer>
    <contents>
    <body>
    <contents>
    <form name="form0" method="post">
    <contents>
    <messageTextInput model="${bindings.password}" text="username"/>
    <messageTextInput model="${bindings.username}" text="password"/>
    <submitButton text="submit" event="success" destination="inputAction.do"/>
    </contents>
    </form>
    </contents>
    </body>
    </contents>
    </document>
    </contents>
    </dataScope>
    </content>
    <handlers>
    <!-- Add EventHandlers (<event> elements) here -->
    </handlers>
    </page>
    my display uix
    <?xml version="1.0" encoding="windows-1252"?>
    <page xmlns="http://xmlns.oracle.com/uix/controller"
    xmlns:ui="http://xmlns.oracle.com/uix/ui"
    xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
    xmlns:html="http://www.w3.org/TR/REC-html40"
    expressionLanguage="el">
    <content>
    <dataScope xmlns="http://xmlns.oracle.com/uix/ui">
    <provider>
    <!-- Add DataProviders (<data> elements) here -->
    </provider>
    <contents>
    <document>
    <metaContainer>
    <!-- Set the page title -->
    <head title=""/>
    </metaContainer>
    <contents>
    <body>
    <contents>
    <form name="form0">
    <contents>
    <messageStyledText model="${bindings.password}" prompt="Prompt 0"/>
    <messageStyledText model="${bindings.username}" prompt="Prompt 1"/>
    </contents>
    </form>
    </contents>
    </body>
    </contents>
    </document>
    </contents>
    </dataScope>
    </content>
    <handlers>
    <!-- Add EventHandlers (<event> elements) here -->
    </handlers>
    </page>
    my model bean
    package order.model;
    public class TestBean
    private String username;
    private String password;
    public TestBean()
    public String getUsername()
    return username;
    public void setUsername(String username)
    this.username=username;
    System.out.println("the username after actions class:"+username);
    public String getPassword()
    return password;
    public void setPassword(String password)
    this.password=password;
    my data Action class
    package order.view;
    import oracle.adf.controller.struts.actions.DataAction;
    import oracle.adf.controller.struts.actions.DataActionContext;
    import oracle.jbo.uicli.binding.JUCtrlActionBinding;
    import oracle.jbo.uicli.binding.JUCtrlAttrsBinding;
    import order.model.TestBean;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionForward;
    public class InputAction extends DataAction
    * Delegate to the Struts page lifecycle implementation
    * {@link StrutsJspLifecycle#findForward findForward}
    * @param actionContext the lifecycle context for the DataAction
    * @throws Exception
    protected void findForward(DataActionContext actionContext) throws Exception
    // TODO: Override this oracle.adf.controller.struts.actions.DataAction method
    //super.findForward(actionContext);
    TestBean testbean=new TestBean();
    System.out.println("this is action form"+actionContext.getActionForm());
    String username=(String)((JUCtrlAttrsBinding)actionContext.getBindingContainer().findCtrlBinding("username")).getInputValue();
    System.out.println("this is username"+username);
    String username1=username+"hye wats up";
    testbean.setUsername(username1);
    ActionForward forward=actionContext.getActionForward();
    ActionMapping mapping =actionContext.getActionMapping();
    System.out.println("this is mapping"+mapping);
    mapping.findForward("success");
    // To handle an event named "yourname" add a method:
    // public void onYourname(DataActionContext ctx)
    // To override a method of the lifecycle, go to
    // the main menu "Tools/Override Methods...".
    check this out iam unable to display in my display page so help me out if any one can

    No, in this case, I'm using standard JSP with ADF and struts validator.
    If I don't use struts validator and there are errors (such as putting a string into a number which produces a jbo-25009), the list value will be retained.
    When using the validator, it appears that it is NOT retained.
    I've written some code to attempt to set the list element back, which "looks like" it's working right now.
    There's still a problem with the second scenario:
    1. user clicks checkbox and hits [submit]
    2. get's error - you have to enter 5 address items
    3. User wants to backout, so he unchecks the box and resubmits
    4. The box redisplays as "checked"
    SO, at that point, I thought... can't I use YOUR EXAMPLE on how to handle a checkbox.
    I place some code in the reset method of the form to perform this:
    map.put("AddressChangeFlag", (String) "" );
    (that is, I've detected via the request that this flag is null), so I'm trying to make sure it retains it!
    I do that and it runs into a problem during the processUpdateModel aT:
    BindingContainerValidationForm updateForm= (BindingContainerValidationForm) actionContext.getActionForm();
    //Get the binding for our particular column JUCtrlAttrsBinding checkBoxBinding = (JUCtrlAttrsBinding)updateForm.get("AddressChangeFlag");
    call, with an error:
    JBO-29000: Unexpected exception caught: java.lang.ClassCastException, msg=java.lang.String
    java.lang.String
    The value for updateForm.get("AddressChangeFlag") is "", which I'm assuming means the form field is no longer in the request object??
    I'm lost at this point, and have been working on it for more than 1 day.
    Thanks for responding though, and I await feedback ;)

  • Urgent: how to really seperate business logic class from data access class

    Hello,
    I've this problem here on my hand and i really need help urgently. so please allow me to thank anyone who replies to this thread =)
    Before i go any futhur, let me present a scenario. this will help make my question clearer.
    "A user choose to view his account information"
    here, i've attempted to do the following. i've tried to seperate my application into 3 layers, the GUI layer, the business logic layer, and the data access layer.
    classically, the GUI layer only knows which object it should invoke, for example in the case above, the GUI would instantiate an Account object and prob the displayAcctInfo method of the Account object.
    here is how my Account class looks like:
    public class Account
    private acctNo;
    private userid;
    private password;
    private Customer acctOwner;
    the way this class is being modelled is that there is a handle to a customer object.
    that being the case, when i want to retrieve back account information, how do i go about retrieveing the information on the customer? should my data access class have knowledge on how the customer is being programmed? ie setName, getName, setAge, getAge all these methods etc? if not, how do i restore the state of the Customer object nested inside?
    is there a better way to archieve the solution to my problem above? i would appriciate it for any help rendered =)
    Yours sincerely,
    Javier

    public class AccountThat looks like a business layer object to me.
    In a large application the GUI probably shouldn't ever touch business objects. It makes requests to the business layer for specific information. For example you might have a class called CustomerAccountSummary - the data for that might come entirely from the Account object or it might come from Account and Customer.
    When the GUI requests information it receives it as a 'primitive' - which is a class that has no behaviour (methods), just data. This keeps the interface between the GUI and business layer simple and makes it easier to maintain.
    When using a primitive there are four operations: query, create, update and delete.
    For a query the gui sets only the attributes in the primitive that will be specifically queried for (or a specialized primitive can be created for this.) The result of a query is either a single primitive or a collection of primitives. Each primitive will have all the attributes defined.
    For a create all of the attributes are set. The gui calls a method and passes the primtive.
    For an update, usually all fields are defined although this can vary. The gui calls a method and passes the primitive.
    For a delete, only the 'key' fields are set (more can be but they are not used.) The gui calls a method and passes the primitive.
    Also keep in mind that a clean seperation is always an idealization. For example verify that duplicate records are not created is a business logic requirement (the database doesn't care.) However, it is much easier and more efficient to handle that rule in the database rather than in the business layer.

  • How to get Custom Time Correction business logic implement for ESS in R/3?

    Hi Experts,
    I am in trouble of implementing the custom requirement of correcting the time in ESS. I have to implement the time corrections as per business logic.
    Can any body tell me where to do this?
    What I need is suppose employee DWS is from 9:30 AM to 6:00 PM and suppose he forgot to punch the In time and then corects the entry for 9:30 AM in ESS then it get inserted into the R/3 data but now requirement is if support the employee has punched but at 10:00 AM and then corrects to 9:30 AM then it does not change the 10:00 AM and we wanna deleted these 10 AM entry.
    Thanks in advance.

    I have solved by created enhancement spot in PT_COR_REQ
    for method IF_EX_PT_COR_REQ~POST_VIA_BLOP
    Regards,
    Gaurav Patwari

  • Where is the best place to implement business logic in ADF application?

    I am using jdeveloper 11g R2 , JSF Facelet
    Where is the best place to implement business logic in ADF application?
    I mean something like service layer in Spring
    Appreciate your comments
    Regards
    Mohsen

    Depends on what your logic does and what data it deals with, but in general business logic is in the ADF BC layer.
    Some goes into entity objects - for things like attribute or row validation.
    Some goes into view objects - for things like calculation.
    Some goes into AM - for things like service methods for UI clients.

  • Business logic in EO, VO - design advice required

    Hi all,
    I'm looking for some design advice on the best way to approach this issue - or in fact advice that I'm making an issue out of something where it doens't need to be !
    Lets say I have a single entity object called UsersEO. I have two view objects called NewUserVO and ExistingUserVO. I use the NewUserVO just for inserting new records and the ExistingUserVO for modifying existing records. When users are editing existing users, I need to provide a checkbox that indicates that when the record is saved, their password needs to be re-generated and emailed out to the user.
    I want to include the check of the "GeneratePassword" attribute while processing the rest of my user business logic, in the doDML method of UsersEOImpl. From here I will call a database procedure that handles changing the password and emailing the user.
    Initially I created a transient attribute "GeneratePassword" in ExistingUserVO but then to access this from within the UsersEOImpl.doDML would require me getting the AM from the transaction, and getting the current row of the ExistingUserVO. I believe that this is bad practice to access a VO from within a EO ?
    Is my only option here to create the transient attribute "GeneratePassword" on the UsersEO and then include in the ExistingUserVO but not the NewUserVO ? That way I can easily access the "GeneratePassword" attribute from with the doDML without have to accessing the VO.
    If I have 10 different VO's that require different attributes, it just seems strange to add 10 attributes to the underlying EO and then only include the relevant entity attribute in each VO - or is this exactly what I should be doing ?
    On a slightly different note, but similar theme - if I had a "VOTransaction" attribute in my EO and I included this in each VO created from the EO - how would I set different values in this attribute for each VO so that within the EOImpl I would know which VO was triggering the entity validation ??
    Many thanks for your help !
    Cheers,
    Brent

    >
    If I have 10 different VO's that require different attributes, it just seems strange to add 10 attributes to the underlying EO and then only include the relevant entity attribute in each VO - or is this exactly what I should be doing ?
    How about creating a BaseVO which extends EO (including transient attributes for password change and voName/Type detail ) that provide a default value for voName/Type attribute and all other VO extending the BaseVO and overriding that attribute setter to specify the name/type?

  • Where to implement my Business Logic in ADF?

    Hi,
    I am new to Oracle ADF. I found this forum very useful to get my queries and doubts answered. Thanks to the participants.
    I am basically from Struts background,
    Where i design my UI in jsp pages using Struts tags,
    Actions and some utility classes handles my most of the business logic (generally called as Business Layer)
    Then i have custom DAOs or Data Layer to query or update the data in database.
    Now as I am into new Project and I have to learn Oracle ADF.
    I started learning this by following some questions in the forums and various sites (from Google).
    I got info on How to create Entity Objects, Value objects etc.
    But my major doubt is where shall i write my Business Logic in this stack?
    I can easily drag and drop my data controls into my JSF page and create table, forms or charts. But if i have a multi line business logic, say for a Submit button, In which i may be doing the following steps -
    a.  Get data pertaining to user role , department, his tenure in the department etc
    b. On submit do processing based on data collected in above step.
    c. update data in data base.
    d. initiate an approval process
    e. call some business process for Approval
    f. Audit Trail
    g. Transaction handling
    and so many other steps (I know most of you will have gone through these situation before starting work on ADF)
    Now, in the above scenario in Oracle ADF layers where shall i write this whole bunch of logic or steps and then forward the user the page depending upon the outcome of this logic.
    Please let me know where to write all this??
    Thanks a lot,
    Amit
    Edited by: ur.amit on May 13, 2010 4:58 PM

    Generally speaking all of that code would reside in the app module Impl classes or the View object Impl classes - for VOs and AMs you can expose subclasses and add code in there - you can then define whether any of your methods should be exposed to the client, in which case they appear in the Data Controls panel as operations.
    General word of advice -keep business logic code in the Model - don't be tempted to start trying to access your AMs and do any of this stuff from the ViewController project. Keep it nice and simple and just access ALL the business logic code through ADF Model.
    Hope this helps
    Grant

  • Basic query abt business logic

    i need to have a website which will search from a database and display results is it advisable to have my business logic (i.e database query)in servlet only since it is a small aplication or i should have a different file for business logic?
    I am very new to this technologies no do not have much knowledge.
    i am thinking to use jsp for display since it automatically handles sessions.
    tia

    so i should have my database query logic
    based on search parameters in my servlet only???No
    should have a different file for business logic?Yes. Your servlet can create an object of a Search class(in a different file) and call its methods to do the searching. Then your servlet can attach the result to the request:
    request.setAttribute("someName", SearchResults);and then forward the request to the JSP using a RequestDispatcher:
    RequestDispatcher view = request.getRequestDispatcher("/results.jsp");
    view.forward(request, response);Then your jsp can retrieve the data:
    SearchResults data  = (SearchResults) request.getAttribute("someName");MVC. Model View Controller:
    Controller = servlet
    Model = Search class
    View = jsp
    Your directory structure might look something like this:
    yourApp
    --searchForm.htm
    --results.jsp
    --WEB-INF
    -------classes
    -----------com
    ---------------myWebsite
    --------------------web
    --------------------------MyServlet.class (package com.myWebsite.web;)
    --------------------model
    --------------------------Search.class (package com.myWebsite.model;)

  • Entity Beans and Session beans to represet Business lOgic

    How cam we implement Entity Beans and Session beans to represent Business Logic.
    Can anyone explain how can we do this.
    Regards...

    I have session beans calling method in entity beans and any client
    doesn't have access to entity beans, only via session beans.
    If i define security policy and method permissions for session beans
    only, do entity beans use that permissions when calling their methods
    from sessions beans OR should i define the security policy for entity
    beans separately?If you want to set the permission on individual
    methods of entity bean ( with different roles)
    you have to do it separately.
    If you want to delegate the Authenticated user along with
    the method call to the Entity Bean you can use
    run-as-identity-principal.
    For more detail please check out the EJB2.0 Spec.
    -utpal

  • Business Logic in ETL process of Oracle_BI_DW_Base.rep

    Hi,
    Are there any docs or web pages that convey business logic used in informatica mappings used for Order Management ?
    Ex: SIL_SalesOrderLinesFact
    Do we need to open every transformation in it and see the query or sql overrides to acquire business logic ? Or Oracle gives any standard docs on this ?
    Thanks,

    Short answer is no. There is no Oracle document that gives the "business logic" for all the ETL mappings. It would be wonderful if that existed. The best approach is to dig into the mappings and try to understand the flow. Using the DAC and Informatica, along with the DMR (data model reference), you can formulate the general strategy that Oracle uses. Some of the mappings/mapplets/transformations also have some comments. What you will see is that Oracle uses similar strategies across the stack. For instance, the method to do SCD Type 2 changes, or to do Aggregation..or to lookup to get the proper WIDs...its similar across all the OBIA apps.

  • Business logic beans & struts

    hello
    i am new with struts and am developing a application using it. i have some question:
    1) Can one business logic bean interact with another business logic bean with out any intermediate jsp in between them?
    2) How can we call methods of business logic beans using beans tags in jsps and then how to handle the values which these called methods return?
    Help please.

    1) Can one business logic bean interact with another
    business logic bean with out any intermediate jsp in
    between them?yes. just specify that int the strutsconfig.xml that the action forward for the action is to another action.. ie
    <action path="/AircraftLogFileInsert" type="avbase.winairweb.struts.action.AircraftLogFileUpdateAction" scope="session" name="AircraftLogFileForm" validate="true" input="/pages/AircraftLogFileSummary.jsp">
                <forward name="insertsuccess" path="/do/AircraftLogFileList"/>
                <forward name="updatesuccess" path="/do/AircraftLogFileSummary"/>       
                <forward name="startOfSection" path="/do/AircraftLogFile"/>
            </action>In this example all request to /do/* are to struts actions
    2) How can we call methods of business logic beans
    using beans tags in jsps and then how to handle the
    values which these called methods return?
    ok this is acutally multiple questions.
    To use the tags that come with struts you need to first declare them in your jsp file.
    ie...
    <%@taglib uri="winairweb" prefix="winair"%>
    <%@taglib uri="struts-bean" prefix="bean"%>
    <%@taglib uri="struts-html" prefix="html"%>Now you can use these tags. in your jsp.
    <html:form action='myaction'>
        <html:text property='myBeanProperty'/>
    </html:form>The only trick with struts is this. Your form objects are used to populate html form contents. hence the above example would use the form associated with current action to populate where i wrote <html:text property='myBeanProperty' /> with the contents of the form property myBeanProperty..
    I know that wordy.. sorry.
    if you like email me directly [email protected]

  • Where do I write business Logic?

    Hi,
    Where do I write bisiness Logic?
    Tutorial said "It is common practice to include the bean property and the Action
    implementation to which it refers within the same bean class".
    But I thought EventHander Impl is better to write business Logic
    like retrieving the data from database.
    Which is common use?
    Or I need to choose them depending on the situation?
    Thanks in advance for you help.
    tomo

    Thanks for the reply!!
    But I am still confused.
    I thought I can write business logic A and B.
    What is difference between A and B ??
    Hi tomo,
    In the two options you provide the difference is not that much. The ActionListener instance willhave to be registered in your JSP of course to listen to the button or hyperlink with the f:action_listner tag. But in both cases your biz logic is in your ui. I think that is the wrong direction for you to head.
    I think the real question should be (forgive me if I'm pulling the discussion away from your question, but I think this is relevant) where does the business logic go.
    As Kito said your biz logic belongs apart from your UI logic (classic MVC approach). So in the real world what does that mean? As you suggest in option B in your last post a bean provides an action so that it can be specified via the actionRef attribute. This action in turn invokes a method on the bean it comes from which then invokes the business logic on the 'real' business logic.
    The Action becomes simply a translator (or part of the Adaptor pattern from the GoF book).
    For example lets say you have a bean that does biz processing like this;
    public interface CatalogFacade {
      public Collection getProducts(ProductSearchCriteria criteria);
    }And you want to invoke that 'business logic' from your JSF UI. The button would be declared with this code
    <h:comman_button id="searchCommand" type="submit"
                        label="Search"
                        commandName="search"
                        actionRef="searchBean.searchAction"/>In your searchBean you have many options to return the searchAction but I prefer the following
    public class SearchBean {
       public SearchFacade searchFacade = null; // this could be a managed bean or an EJBSession or whatnot
       public ProductSearchCriteria productSearchCriteria = null; // this should be 'filled' in by the form the button is on
       private transient Action searchAction = new Action() {
        public String invoke() {
          return search();
      public Action getSearchAction() {
        return searchAction;
      public void search() {
        Collection products = searchFacade.search(productSearchCriteria);
        // place the products collection into the next page's bean so that is can be found via valueRef attributes
    }Notice that no database hits are happening in the UI code. Also there is no business logic here either.
    It is very important to keep these two concerns divided for ease of maintenance. The typical reasoning goes something like this, 'your ui is very likely to change so keep it separate from your business logic'. Other reasons to be careful about mixing UI and biz logic is the likely hood that you will get very different behavior (one probably wrong) if you have to and another client to your biz logic.
    For example in the earlier product search stuff. If we needed a web service front end to the 'searchProducts' functionality and we had the db hit happening in the action or page bean we would be stuck. With the above impl we get to just put a WS over the facade and we are done.
    Hope this helps.
    You can also look at some of the blueprint patterns for more info. They start here;
    http://java.sun.com/blueprints/patterns/index.html
    While some of the EJB specific patterns might be more involved than you need they provide excelent archtectural guidence for web only apps as well.
    Good luck,
    -bd-

  • BC4J - Big Project - Business Logic

    What is the suggested best practice on where to locate business logic in a big application?
    It would appear that entity objects are good for table/domain level validation.
    View objects are good to ensure that the data between multiple tables is copesthetic.
    But where would one place business process logic that could potentially span multiple views and even multiple application modules?
    Also what is the difference between retrieving an application module using the ApplicationModuleHome.create function and from the applicationpool?
    Thanks,
    Marty
    null

    re: "duplicate"
    You betchya. This is mimicing a SmallTalk implementation I worked with years back.
    In some cases, the checks are not duplicated because they share "objects" instantiated for those entities. And in the case of 3 frames all with the same field.. only one check fires ( the active frame where they entered the data ) and all the others don't fire.. they just clean up when the user corrects the data.
    In some cases putting validation in the EO appears to just add work at both ends, and adds another layer of confusion for programmers. ( I.E. A programmer is looking at the code.. it is NOT apparent without complete knowledge of the EO code what is and is not being checked. Is that maintainable? maybe, maybe not )
    Here's an example of an edit check... confirming that a part number is valid for a custom Find Panel.. and while we're at it, let's turn * to % for a LIKE statement so all our Access users don't get confused:
    String oldPart = ((ImmediateAccess)partNumber_tf.getDataItem()).getValueAsString().toUpperCase();
    String wildPart = new String();
    if (oldPart.indexOf("*") > 0)
    { wildPart = oldPart.substring(0,oldPart.indexOf("*"))+"%"+
    oldPart.substring(oldPart.indexOf("*")+1);
    oldPart = wildPart;
    try { ((ImmediateAccess)partNumber_tf.getDataItem()).setValue(oldPart); }
    catch ( Exception e0 ) { System.out.println(e0.toString()); }
    if (oldPart.indexOf("%") < 0)
    if (!isValidPartNumber(oldPart) )
    try { ((ImmediateAccess)partNumber_tf.getDataItem()).setValue(""); }
    catch (Exception e0) { System.out.println(e0.toString()); }
    boolean isValidPartNumber( String partNumber )
    boolean isValid = true;
    if (!partNumber.equals("") )
    try
    Statement call= OpenDBConnections.myJdbcConnection.createStatement();
    ResultSet rset=call.executeQuery("SELECT getPartDescription('"+
    partNumber+
    "') AS PART_DESC FROM DUAL");
    rset.next();
    if (rset.getString("PART_DESC").startsWith("ERROR") )
    statusLine_tf.setText("USER ERROR: Invalid Part Number!");
    Toolkit.getDefaultToolkit().beep();
    isValid = false;
    else
    { status_tf.setText(""); }
    rset.close();
    call.close();
    catch (SQLException esql)
    {System.out.println(esql.toString());}
    return isValid;
    Notes:
    1. I do a JDBC call cuz I don't want a lock on my target records. It's a bloody read only request. ( Or is there a way to set that up..as far as I can tell UPDATABLE seems to affect the UI when defined in the View Object.. it has nothing to do with locking? The EO may be updatable by the application... by read only for this particular purpose... )
    2. If I understand you right, you are saying to do the IsValidPartNumber code in the validateEntity() method. I want it NOW.. not at commit time.. or is validateEntity "run" on any change to the EO? Or should it be put on the impl setr so that the try catch around the setValue() of the DACF element will catch it? ( I like that )
    3. The status line and beeping is managed by the try catch around the dacf setValue(), as well as the clearning of the appropriate DACF control and refocus (if needed ).
    4. And that the validation should REALLY be applied to a DOMAIN of "PartNumberDomain".. since it really applies to many EOs with attributes that are of domain "PartNumberDomain".
    That last item is VERY interesting to me. I used such stuff in Rdb in the database. Catch is that domain and their power and implementation is scantily described in training and in the online Help.
    I'm guessing that when I do a DACF entry that the setr in the EO can be used to validate.. and that the DOMAIN edit gets automatically executed as well.. and that it shows up as a JBOException to the try/catch at the application source level for the programmer to deal with, right?
    Note that when Dec/Rdb started on this sorta course 10 years ago, it was clear to everyone that it was a house of ravioli code.. and that without a POWERFUL object repository it was very, very difficult for la rge projects to be built so that programmers would have clear visibility to all the conditions/issues.
    Want to bet that you can count on one hand (or less) the number of customers outside of Oracle who have implemented domain validation code and applied it to Entity Object attributes?
    Note that in all these cases, I still need to implement the same checks in my triggers to protect the database against ALL comers. So everything gets checked twice.
    re: BC4J, wrappers, and java stored procedures. All interesting ideas. I booted that option out during this implementation because the goal was to implement the application... I estimated we'd extend the project another 2-3 months by taking the approach you imply, due to learning curve, conceptual errors on our part during implementation, bugs in the Oracle code awaiting fixing, ad nauseam. That rough estimate has been born out by the fact that JDEV issues of implementation has caused my project to slide over 2 months. Simple, easy things I had alotted a short effort for based on experience with MS Access, Delphi, Forms and other tools turned out to wildly off base. ( Example: the imageControl that simply doesn't work, but is documented as being so easy and quick to put in ).
    Thanks again. BTW. If you don't know, I'll be at Oracle HQ on Friday the 16th. Hope to see you again, if just to say hi.
    null

Maybe you are looking for

  • Name of track changes to modified date when importing mp4

    I have two .mp4 files: (both names listed below are the filenames) Valentines Day Torin.mp4 with a modified filed date of 02/15/2010 Phoebe Confirmation Entrance.mp4 with a modified date of 03/18/2010 When I import the Valentines Day Torin file, the

  • Adding datafile to ASM file system tablespace

    Hi Can some one plz help in writing a script to add a datafile to the system tablespace on ASM filesystems. below is the result of the query .. select file_name, bytes, autoextensible, maxbytes from dba_data_files where tablespace_name='SYSTEM'; FILE

  • Lags while c++ compile linking

    Hello, i got a system lags while gcc is linking libs on a big project, so i need to stop compile/linking if i need do some rly important stuff. Is there any way to decrease system priority of linking or other ways to beat lags?

  • Zero records in Delta Queue for Non-LO Datasource

    Hi, I have a process chain which loads data daily and last loaded on 5th of this month which is a delta load to DSO, and then I have triggered process chain on 10th  and now the process chain got successful but delta is returning zero records. I have

  • How do you increase storage on an iPhone 5C?

    How do I increase/buy storage capacity for an iPhone 5C?