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;)

Similar Messages

  • 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

  • Business Logic Service

    hello friends,
    how to use bls?
    what are the   Pre requirements for using BLS?
    please give any example for BLS application?
    - Murali

    Murali,
    Business Logic Editor is the place where you can design all your application logics in xMII.I advice you to go through the help documentation to get an idea about it
    http://localhost/LighthammerCMS/Help/SAP_xMII_Help.htm
    BLS has a set of action blocks for designing your logics. Transactions built using BLS can be exposed as web service for external use.
    And to answer your other two questions..
    I'm not sure about what you mean by pre requisites..BLS comes along with xMII and there are no separate prerequisites for it...
    For working with it I would recommend basic knowledge on xml, xpath expressions...
    BLS as such cannot create a whole application, but together with Query and display templates, an application can be built...The application can be built using  front page and on click on a button you can call a transaction that gives a table of values that are displayed using  Query and display templates
    Hope this helps.. Reward points if you find them useful
    Regards,
    Ajitha

  • Can we use WHO columns in Business Logic implementation

    Hi,
    Can we use WHO columns for business logic implementation..?
    From one table I need to pick up the latest record. I have a ActionDate column in the table which stores the date of the action.
    But on the same day there can be multiple action records. ie Multiple records have same ActionDate.
    Select * from action_table where action_date=(maximum action_date)
    The above query will return more than 1 record.
    Now can I use the Creation_Date which is a WHO column to identify the latest record..?
    Will it introduce any issues if I use creation_date WHO column?
    Usage of WHO column in application logic, Is it against the Standards ?
    Thanks a lot.

    I guess you are talking about populating the value using the history column creation_dt from EO.
    If so, you can use then. We are using them in all our applications to populate WHO columns of our table.
    Infact as far as I know, even Oracle application uses them.
    They generally populate the timestamp, so you may need to format them when doing date comparisons.
    Hope that helps.
    Amit

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

  • Business Logic and Business Rules

    Hi,
    I have a very basic question. If we develop a new screen on top of ECC using Webdynpro ABAP to replace a ECC default screen, say for an example, ME51n screen for purchase requisition to be replaced by a custom screen developed in ABAP Webdynpro, then how do we incorporate the inbuild business logic and the business rules of me51n in to this new screen developed in ABAP Webdynpro? In short, how do we incorporate business logic and rules in to ABAP Webdynpro application?
    do we have to code all the logic from scratch or we can use existing logic? If we can, how.
    Thank you for your help.
    Shai

    Duplicate thread
    Business Logic and Business Rules
    could you please close it.
    thanks
    sarbjeet singh

  • Business Logic Editor with Complex Transasctions

    I'm starting to have some serious problems using the Business Logic Editor with reasonably large (but by no means huge) transactions. These transactions also have nested transaction calls down a few layers. The main symptoms are:
    1)  When opening the Link Editor on the first action it is somewhat sluggish. Opening the Link Editor on the last action can take over 60 seconds.
    2)  If adding a new Transaction Call action, selecting the called transaction in the Configure window doesn't work. The transaction can be selected OK, but the browse window will not close. It has to be cancelled. The Link Editor does not show the transaction's input, even though the Configure window will now show the selected transaction's path OK.
    3)  If the transaction is Saved after 2), that transaction will not open again in the Logic Editor, even after a reboot.
    Memory seems to be part of the formula. The above is on a notebook with 1Gb of RAM. On a dual core with 2 Gb, the problems are less, but not much. On a server with 8Gb, the symptoms disappear.
    Does anyone know if there is a recommended minimum system config for using the Logic Editor?
    What is actually happening when a transaction with nested Transaction Call actions is loaded in the Editor and for exection? I have many transactions that don't have the above problems, but they take a long time to open in the Logic Editor, and up to 1.5 seconds to load when executing the transaction (this is as per the F5 timings).
    Thanks,
    Bill

    Rick,
    These days I'm very careful about large embedded reference docs in my transactions. I actually go through the .trx files with notebook looking for any large chunks of that sort of XML and make sure they are eliminated.
    In the case of this transaction, by the time I get to the actual SQL query action (and remember it's a few layers of nested transaction calls down), it can't run the query anyway. The Query Template name in the configure window is blank. That and any params are set dynamically in Links at run time (the Query Template name actually comes from a config file). If I try Limit Rowcount or Yes when I close the configure window, it just gives an error because it has no idea what query template to run.
    Given this, the problem just doesn't seem related to fetching data. And how would this cause the Links window to take so long to open in the Logic Editor?
    Bill

  • Business Logic in Oracle Applications (General Question)

    Hello everyone!
    I am relatively new to Oracle Apps and interested in learning and joining this community.
    I was trying to figure out how is the Business Logic programmed in E-Business Suite. Is it just PL/SQL or is it BC4J? Is there anyone who could help me answer this question or point me in the right direction (I went through the documentation very quickly (it is rather large so it was only "briefly") and could not find anything that would answer my question exactly)
    By Business Logic I mean business-related tasks such as "enter a journal entry" or "issue sales order" (with a higher or lower level of granularity of course)
    Any help is much appreciated !

    Just to expand on Bala's answer, it depends on how your application is architected.
    If you have a Forms based application, then your Business Logic (BL) resides in PLSQL. The forms tier performs the basic validation and partial BL execution and passes the data to the handlers in the database to perform the DMLs and initiate required Business Process.
    If you have a OA Fwk based application, then your BL could reside either in BC4J or PLSQL. There are OA Fwk applications that are written that performs some business logic execution within the middle tier and passes the rest to underlying PLSQL code. Take for example an application that was originally written in Forms but later on extended or migrated to OA Fwk. Since most of the BL was already written in PLSQL and some of the forms would still be using the same PLSQL APIs, it essential that the OA Fwk based application too uses those APIs to be in synch.
    If you are designing a new application to be based on OA Fwk, it is strongly recommended that you go with your BL as much as on the middle tier.
    So it all depends... :)
    Thanks
    Vijay

  • UCES Business logic / Implementation question

    Hello,
    I hope this is the right forum for this, I found nothing relevant about it with the search...
    I hope you can help me or perhaps at least point me in the right direction or give me some links.
    It's really hard to find anything substantial about UCES on the net, so ANY help is greatly appreciated!!!
    Okay here we go:
    I have a requirement for a client who wants a Web 2.0 Portal with the Business logic implemented with UCES (Utility Customer E-Services)
    What I now (for a start) need to know is:
    1.
    How is business functionality in UCES implemented? With Java or with ABAP? Does anyone know this? Are both approaches possible?
    2.
    How does a possible interface between UCES business logic and the frontend look like?
    - JSP -> EJB -> Java Connector -> ABAP?
    - JSP -> EJB ?
    - JSP -> EJB -> ABAP over Web Services ?
    - or other ?
    Like you see, I'm really just trying to get a grip on the basics, a starting point from which to find further information. So really, anyone who has experience with this, please answer, it's greatly appreciated.
    Thanks
    Ralf

    Hello Ralf,
    This seems to be the wrong forum but a quick check and I found
    Re: SAP Utilities Customers E-Services (SAP-UCES) - Documentation?
    Maybe this can help.
    Regards
    Mark

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

  • Real app business logic, access serialization

    Hi,
    in our real application we have some business logic.
    The bc4j examples show for example how to limit the value
    of a colum between two values.
    But our business logic is not limited to a so
    simple case.
    For us is very common that business logic involves
    more (aggregate) tables.
    For example consider a invoice and
    the line of the invoice. These are two tables but
    a business rule say that the sum of the line should
    be the total column of the invoice. Moreover the
    total of the invoice can't be zero. The need the
    existence of the total column in invoice is required
    because speed up queries and for the constraints and
    we can't make it only a display value of a
    query.
    To avoid data corruption we have noted that access
    should serialized for a invoice. Otherwise two user
    can change the lines and the total can be correct in the
    session but may not be correct at the end of the
    two commit.
    How can we obtain this in bc4j? Where should we place
    the code? How to make access of the invoice serialized?
    There is some documentation or code example of this?
    Very thanks in advance!

    By marking the lines entity to be composed with the invoice entity, and marking the "lock top-level entity" you can automatically achieve the serialization you're looking for using BC4J.
    If anything in the invoice, or any composed children are modified, it will lock the top-level parent (invoice) before allowing the edit to proceed.
    To express a rule that asserts a rule about the sum of the detail lines, write a entity-level validation rule in the invoice (parent) entity which uses the association accessor to iterate the lines and calculate the sum.

  • Design ?:  how much business logic in JSP?

    Hello everyone --
    I can't seem to make up my mind and my collegues aren't helping, so maybe a few of you could offer your opinions.
    I have a simple JSP that is just a web interface to a database and right now I have the business logic (an entire class called TalkToDb) completely separated from the JSP in another file. The JSP isn't really THAT dynamic (I don't even have links); the top part is just a series of forms that query and update the db. It's the bottom part that has dynamically-generated tables populated by db info.
    The question is, does the business logic really need to be separated from the presention stuff? Is it really dumb integrate my TalkToDb class into the JSP? What are arguments for doing it one way over the other? Thanks a heap for any feedback at all,
    -Kwj.

    For a simple, one page project, you don't gain much in speed and development time by separating the logic, but it's a bad habit to get into if your goal is to develop sophisticated web applications. The rule I develop with is "if they tell me they want one page, anticipate them wanting ten pages". You never know where a "simple" app will grow. Using a class to handle your logic is a better design.
    If you are confident that the project is going to be a quick, cut and dry database query and results display, then you can put it all in the JSP page, but just know that you are decreasing scalability for the tradeoff of quicker development.
    No one will tell you that you did it wrong if you use a class and a JSP page together. However, you open yourself up to criticism from people looking for more sophisticated designs if you throw it all in the one page.
    Now, that all being said - I have a few single page JSP's that we didn't want to create entire apps for. We just put the whole report logic right on the page. But the majority of my projects are well designed MVC applications.
    Michael

  • Accessing LCDS Persistence Layer for use in Server-Side Business Logic

    Within server-side business logic, I want to be able to get a persisted object from LCDS, manipulate  that object, and then use LCDS to persist those changes to the database  as well as send those changes to the client.
    Is it possible to access LCDS' persistence layer (Hibernate) to be used by server-side business logic?
    I have attempted to use DataServiceTransaction.getItem(...).  However, for objects that contain a collection of other objects I get this error:
    [LCDS] Runtime exception while trying to fetch a property from hibernate: flex.data.DataServiceException: There is no current message broker to return.
    When calling DataServiceTransaction.updateItem(...) for objects that contain a collection of other objects, I get this error:
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sd.pojo.Book.chapters, no session or session was closed
    Also, it appears that DataServiceTransaction.updateItem does NOT update the database?
    I have resorted to building my own Hibernate SessionFactory, but that seems unnecessary.
    One other piece of information is that I am using the Fiber modeling tool to build and deploy the model to the server.  I am generating the Java classes with Fiber and making them available to be used on the server.
    Thanks,
    Collin

    Thanks for the help guys.
    I guess what I'm really trying to get straight in my own mind is whether supporting interraction and control of eJB database interraction is still using the same functionality as having a stand alone app interracting with a db.
    I'm thinking about; the implications of using eJBs specific query language and the different way in which eJBs use db connections (either for the period of their lifetime or just for the duration of one interaction) compared with a stand alone app, which would maintain a connection to the database(s) while it is open.
    Connection pooling and caching of DB objects is often quoted as being a middle tier activity, but what does this mean when all 3 tiers reside on the same machine?
    Once again thanks for your comments and advice.
    Mark

  • 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

  • Future support for using PL/SQL core business logic with ADF BC

    We want to migrate our large Forms client/server (6i) application to ADF, possibly using a migration tool like Ciphersoft Exodus.
    One scenario could be to use ADF BC and ADF-Faces or a different JSF-Implementation for presentation and business layer but keep our heavy PL/SQL-businesslogic inside the Oracle database in packages, triggers, functions and procedures.
    This scenario could be chosen due to the huge amount of interconnected logic inside the database (10 years of development; no technical components; any package may access any table and more of this kind of dependencies). The business logic nowadays held in Forms client will be moved mainly into the database as a prerequisite to this scenario.
    Choosing this "keep-logic-in-DB"-scenario we need a good support by ADF BC to do so. We know and prototyped that it is possible to call some PL/SQL via JDBC from ADF BC and it is possible to use stored procedure calls for standard business entity data access (ins, del, upd, ..). But this does not solve our problems. We want to reuse core business logic coded in PL/SQL. This is much more than change the ADF standard behavior for an update with an own PL/SQL-call.
    Now my question:
    Will there be a kind of sophisticated support to use ADF BC in combination with database-kept logic?
    If so, when will this happen and how will the common problems of transactional state inside the database and inside the ADF BC be solved? Any plans or ideas yet?
    Many other clients do have similar applications built in Forms and PL/SQL and would be glad to hear about a path of direction.
    I've read the technical article 'understanding the ADF BC state management feature' which you have contributed to. One current limitation is pointed out there: Using PL/SQL with ADF BC limits ADF AM pooling to 'restricted level' which reduces scalability.
    Are you aware of additional main problems/tasks to solve when using PL/SQL heavily with ADF BC, which we have to think about?
    Thank you for any response.
    Ingmar

    My main problem is two 'concurrent' areas holding state in an application system based on DB-stored PL/SQL-logic in combination with ADF BC.
    For a new System everything can be made ok:
    Sure, it is possible to build a new system with the business logic included in ADF BC only. All long-living state will be handled in the BC layer ( including support for UnitsOfWork longer than the webside short HTTP-requests and HTTP-sessions and longer than the database transactions.
    For an old system these problems arise:
    1. DB data changes not reflected in BC layer:
    Our PL/SQL-logic changes data in tables without notifying the ADF BC layer (and its cache). To keep the data in ADF BC entity objects identical to the changed database content a synchronization is needed. BC does not know which part of the application data has been changed because it has not initiated the changes through its entity objects. Therefore a full refresh is needed. In a Forms4GL environment the behavior is similar: We do frequently requeries of all relevant (base)tables after calling database stored logic to be sure to get the changed data to display and to operate on it.
    -> Reengineering of the PL/SQL-logic to make the ADF BC layer aware of the changes is a big effort (notifying BC about any change)
    2. longer living database transactions
    Our PL/SQL-logic in some areas makes use of lengthy database transactions. The technical DB-transaction is similar to the UnitOfWork. If we call this existing logic from ADF BC, database state is produced which will not be DB-committed in the same cycle.
    This reduces scalability of ADF BC AM pooling.
    Example:
    a) Call a DB-stored logic to check if some business data is consistent and prepare some data for versioning. This starts a DB-transaction but does not commit it.
    b) Control is handed back to the user interface. Successful result of step a) is displayed
    c) User now executes the versioning operation
    d) Call another DB-stored logic to execute the versioning. DB-transaction is still open
    e) Business layer commits the transaction automatically after successful finishing step d). Otherwise everything from a) to e) is rolled back.
    -> redesign of this behavior (= cutting the 1to1 relation between LogicalUnitOfWork and the technicalDatabaseTransaction is a big effort due to the big amount of code.

Maybe you are looking for

  • Exception while using select

    I trying to select 31 column in my table using select query but an exception is thrown java.sql.SQLException: ORA-00904: "US"."BRANCH_ID": invalid identifier i am able to select the 30 column but not the 31st or 32nd colum. help needed, i have tried

  • How to write the method?

    How do i write the method to generate the following pattern... ++++++++++ 1. method name: drawPattern -+++++++++ 2. method takes an int as parameter that determines --++++++++      the pattern width/height ---+++++++ 3. method returns nothing ----+++

  • Existing Single $19.99/month App - Want to convert to LR & PS

    I signed up for CC this summer, but only for PS.  I now see they are running a deal for $9.99 for Photoshop AND LR.  I'm currently  only getting Photoshop but paying double.  Can I convert my subscription??

  • Subset of an Vector

    Hi, i have an vector and i want to get another vector that is a part of that initial vector just like the substring function of a string gives an subset of the initial string. Can anyone tell me if there is an simple way of doing this, rather than do

  • HELP with Error in /usr/sap/trans :transdir not set

    HI  when i import request from DEV system dev to PRD system P01,error show : XCPRD01:p01adm 1> tp IMPORT DEVK900298 P01 client=01 U0 pf=/usr/sap/trans my PRD and DEV system client number is 01 now the system show: Error in /usr/sap/trans :transdir no