Struts using DAO Design Pattern ..?Please give an example..... URGENT......

Dear all,
I have to develop an application in Struts by using DAO design pattern ..........
Please give an example on Struts using DAO...................
Thank you
Please

I'm glad you asked. It means Read The Flaming Manual. That'd be the struts manual by the way.

Similar Messages

  • Struts using DAO Design Pattern Tutorail

    Can anybody give me a link for the Struts using DAO Design Pattern tutorial
    sample tutorial

    http://javaboutique.internet.com/tutorials/ApacheDAOs/
    Found by using google: strust dao pattern tutorial
    There are more good links using that search...

  • How to generate report from two tables using DAO design pattern?

    Hi,
    Iam using struts with DAO pattern for my application. According to DAO design im creating model class for each table in my database with getter,setter methods. i have no problem when im generating report from one table. but if have i have to join two tables whatis the better way for doing that? is it good practise to create a new model contains properties from both the tables?
    Please help me
    Thanks in Advance
    Rajesh

    Dear Rajesh,
    As per the pattern you are creating equivalent java objects for every database table under consideration in which each db field will become a private attribute and public getter and setter methods.
    If you have to display data from one table the above approach is sufficient enough.
    But in case your database is normalised ..lets take an example of Bank having Branch and Accounts tables. We dont need to repeat the whole information of the branch for every account in that branch. so we prefer to have a branch id in that table....this approach lot of insertion/deletion/updatation anomlies that may exists with the database...
    now lets come back to our topic....we shall create two java objects 1) Branch 2) Account.....
    When ever u just need to display simple report u can do it staright forward,,,,,now if u want to display branch information along with the account information....the two objects just created are not sufficient
    So i suggest u the following approaches
    1) Create an attribute of type Branch in the Accounts Object......
    This shall serve the purpose of displaying the Btranch information
    2) Create a collection object of type ( Vector or ArrayList) which can have objects of Account in the Branch Object,,,
    Now its upto u how shall u fill up the objects with appropriate sql queries.
    The method that i mentioned is followed by Oracle Toplink and Hibernate ....which provide Object to relation mapping layers.
    Any queries ...revert back to me...
    Mahesh

  • DAO Design pattern

    Hi,
    what is the advantages of DAO Design pattern over other design patterns?
    Can anybody tel me

    valooCK wrote:
    NANDA wrote:
    Hi,
    what is the advantages of DAO Design pattern over other design patterns?
    Can anybody tel methe answer is none!
    DAO stands for data access object, it is a non oo pattern, oo is data centric, it makes sense for data to access data. it is something created by poor procedural minds who can never understand what oo is.
    you may occasionary use it as a collection of functionalities or utilities, but thou shalt never use in as a pattern in oop!There are as-yet undiscovered tribes living in the Amazon, who knew you were going to say that
    @OP: Please ignore this troll, he doesn't even understand the very basics of OO, as can be demonstrated in the following thread
    http://forum.java.sun.com/thread.jspa?threadID=5273397&tstart=0
    Just ignore him. He only wants attention. He hasn't got the faintest idea how to write even "Hello World", let alone actually do any OO design

  • DAO design pattern & Transaction boundaries

    I am using a tool to generate a JDBC tier that applies the DAO design pattern. However, the generated code is based on "autocommit"-strategy, i.e. there is no conn.setautocommit(false)-statement in the code.
    I have added statement so that I can handle the transaction by myself. The DataAccessObject-implementation class does however close the connection before returning. I would like to execute the commit outside of the DAO-implementation.
    Anyone who have been experiencing the same problem?
    Best regards
    Lasse Bergstr�m

    I'm not sure if I fully understand your question.
    However, we usually implement such a scenario by doing autocommit false on the connection object and then passing it to the DAO. Finally do a commit on the connection in the calling class.

  • How to use getAncestor(n),getdescendant(child,child) in sql why they are use please give me example

    how to use getAncestor(n),getdescendant(child,child) in sql why they are use please give me example
    jitendra

    Below are a few examples that demonstrate these hierarchyid data type methods.  See the hierarchyid reference in the SQL Server Books Online for more examples of these and other methods (http://technet.microsoft.com/en-us/library/bb677193.aspx).
    --return a child of this node ('/1/')
    SELECT CAST('/' AS hierarchyid).GetDescendant(NULL, NULL).ToString();
    --returns a child of this node greater than child node '/1/' ('/2/')
    SELECT CAST('/' AS hierarchyid).GetDescendant(CAST('/1/' AS hierarchyid), NULL).ToString();
    --returns a child of this node less than chold node '/1/' ('/0/')
    SELECT CAST('/' AS hierarchyid).GetDescendant(NULL, CAST('/1/' AS hierarchyid)).ToString();
    --returns a child of this node greater than child node '/1/' and less than child node '/2/' ('/1.1/')
    SELECT CAST('/' AS hierarchyid).GetDescendant(CAST('/1/' AS hierarchyid), CAST('/2/' AS hierarchyid)).ToString();
    --return ancestor of node 1 level up from this node ('/1/2/')
    SELECT CAST('/1/2/3/' AS hierarchyid).GetAncestor(1).ToString();
    --return ancestor of node 2 levels up from this node ('/1/')
    SELECT CAST('/1/2/3/' AS hierarchyid).GetAncestor(2).ToString();
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Calling standard funtion module in BSP using MVC Design pattern

    HI Everyone,
    I am trying to create one BSP application using MVC Design pattern,
    I want to call standard function module LSO_TRAINING_GET_DETAIL_C, in my BSP Model class,
    can any one tell me how to do this?
    I want to do the model binding also,like i want to retrive data on the frontend bsp screen from the above function module.
    Thanks,
    Vinay
    Edited by: vinay kumar on Jul 3, 2008 12:02 AM

    Hi Vinay,
    If you want to call the FM on some user action , ie on some event than you have to do it in
    DO_HANDLE_EVENT method of your controller class.
    For eg. if you want to call the FM on click of the button, you can do some thing like:
    DATA: button_event TYPE REF TO cl_htmlb_event_button.
    IF htmlb_event IS NOT INITIAL.
      IF htmlb_event->name = 'button'.
          button_event ?= htmlb_event.
         IF htmlb_event->server_event CP 'press'.
              call function LSO_TRAINING_GET_DETAIL_C
                                        exporting
                                         param_exp = val1
                                        importing
                                           param_imp = val2.
                  endif.
          endif.
    endif.
    here press is the OnClick event of the button.
    Now you can use this VAL2 , in the view .You can use the  HTMLB:TABLEVIEW element , if your FM's importing param is a table.
    Hope it helps a bit,
    BE,
    Anubhav.

  • What is IMPORT/EXORT statements ?please give some example code?

    What is IMPORT/EXORT statements ?please give some example code?

    EXPORT :-To read data objects from an ABAP program into ABAP memory, use the following statement:
    Syntax
    EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.
    This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    The EXPORT statement always completely overwrites the contents of any existing data cluster with the same name <key>.
    IMPORT :-To read data objects from ABAP memory into an ABAP program, use the following statement:
    Syntax
    IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
    This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
    they are used to save and reterive data in ABAP memory.
    here is an example to clear about them.
    <b>REPORT ZWA_TEST2 .
    data: it_bkpf type table of bkpf with header line.
    SELECT * FROM bkpf into table it_bkpf.
    EXPORT it_bkpf TO MEMORY ID 'MID'.
    refresh it_bkpf.
    IMPORT it_bkpf FROM MEMORY ID 'MID'.
    LOOP AT It_bkpf.
    write:/ it_bkpf-belnr.
    ENDLOOP.</b>
    Reward points if it is useful.......

  • Using DAO ,TO Pattern without EJB

    Hi,
    I am developing a web application without EJB. I understand those patterns need not use EJB framework. However, it smees to me that without EJB, the role of TO may be simpler.
    In my design, the meaning of TO is to separate the layer between business tier and data access tier. Upon doing some back-end enquiry, the DAO create related TO which can be translate to the business / veiw objects. And the caching will be done on Web tier but not TO layer instead.
    Am I right? Would you please give some comments? Thanks a lot.

    What is the best way to allow the client to
    interact
    with Entity objects, without exposing them. ShouldI
    implement Value objects that are easily serialized
    for transfer across the network?
    If you are not using EJB or a distributed
    architecture, you do not need DTO's or VO's. They
    are an odious construct used to obviate the
    shortcomings of remote method calls over anetwork.
    I strongly disagree.
    They are an obvious and easy model used when the
    following characteristics of a system exist.
    - Different layers.
    - Related data items that are moved throughout the
    layers.
    - Different usage of the related data items by
    different layers.
    Yes, I agree. Note the qualification 'if you are not using a distributed architecture'.
    None of that has anything to do with remote method
    calls over a network. Point of fact the first time I
    used them was in a stand alone application with no
    network traffic except that needed by the database
    driver itself.
    Simply create your domain model objects as POJO's
    s (plain ole Java objects). Persist and retrieve
    your objects via DAO's (data access objects).Your
    service layer (facade) will sit on top of thedomain
    model, encapsulating method calls into logicalunits
    of work.
    And how exactly do you move the customer
    name/customer address from the DAO to the GUI level?I am assuming the dedicated remoting product the OP specifid, Hessian, will handle moving between the tiers, or at least between the controller/view and the business tier.
    - Saish

  • How can I develop a web application using EJB design pattern?

    I have searched over the web and found quite a lot of tutorials on how to use the EJB design pattern.
    I know that there will be a home interface, EJB object interface and a SessionBean.
    But the tutorials often only cover a single class, this made me unable to get a complete picture of how EJB design pattern can be implemented into a whole system.
    I am now required to devleop an online shopping web application using EJB and JSP page.
    I think I will need to create a lot of classes: Member, ShoppingCart, Product...etc.
    What I want to ask is that, do I need to create a home interface, EJB object interface and a SessionBean for each of these classes?
    I really need some ideas on how to develop this system using EJB + JSP pages.
    Many thanks to you all.

    For every EJB that you want to create, you will need to code a home and remote interface and a bean class.
    You could start getting your ideas here
    http://www.theserverside.com/books/wiley/masteringEJB/
    http://www.coreservlets.com

  • Are there any Client/Server Application (using sockets) design patterns?

    Hi,
    The title of the post nearly says it all. I am searching for different design patterns related with the development of a client/server application. I understand that there must be any different ways on how a client/server application can be developed.
    Regards,
    Sim085
    Disclaimer:
    When I enter in the Socket forum on this site I recieve this message "Thank you for any participation in this forum. Due to a lack of relevant activity, we have decided to archive this forum on June 16, 2006. For future posts on this topic, we suggest you use the Networking forum" and I am not allowed to create a new post! However I can see posts done yesterday! All i did is add the forum in 'my forums'. Does this happen to you people as well?

    Hi Sim085...How are you?
    So look this:
    http://forum.java.sun.com/thread.jspa?threadID=5148926&tstart=75
    I don�t know if is what you want...but I hope in this^^
    Ok man...If you have one example for help you is better.
    [ ]

  • JPA DAO Design Pattern

    Hi all,
    I have one abstract DAO class and every sessionbean DAO will extend it.
    here is sample code.
    public abstract SuperDAO{
    @PersistenceContext (unitName = "stars21db")
    private EntityManager em;
    public getEM(){
    return em;
    Here is Session Bean DAO
    @Stateless
    @Local
    public class CapDaoSessionBeanBean extends SuperDAO implements CapDaoSessionBeanLocal {
    public CapDaoSessionBeanBean() {
    public getCustomer(){
    }

    Code is fine, but the wording isn't the right one. You are about to build a Facade. DAO were originally build as the ones who know how to interact with the database, with JPA this is handled by the EntityManager. Therefore the DAO pattern doesn't apply...
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I like to play games on facebook and for some reason I keep getting an error message saying that the shockwave player and flash player has crashed I use firefox could someone please give me step by step instructions to fix this issue?

    I have Windows 8.1, my adobe player is the most updated version also.... hope this helps

    Yeah, Firefox and Flash Player isn't a super stable combination on Windows 8.1 at the moment.  We're collaborating closely with Mozilla to improve that, but that effort is going to happen over several months.
    In the meantime, you might want to take a look at the other options.  Microsoft invested a lot of time and effort into making the Flash experience on Win8.1 really good in IE, as did Google with Chrome.

  • Please give  me example of delimiter in scanner

    Please anyone give me information,I need an example of Scanner method where I can validate an integer date with delimiter
    example -
    dd-mm-yyyy The dash "-" must come in between the dates while the user types the date like 27- 4 -

    I am trying to insert a particular date from scanner method but I am getting error as incompatible type found String expected Date, I tried parser but it didn't work, please check the code and let me can you correct it, I want to enter date through scanner date like 09-06-2008
    import java.text.SimpleDateFormat;
    import java.util.*;
    import java.io.*;
    import java.util.Date;
    public class Example
    // instance variables - replace the example below with your own
    Scanner scan=new Scanner(System.in);
    public void date()
    Date date = new Date();
    date = scan.next();
    String DATE_FORMAT = "MM/dd/yyyy";
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
    System.out.println("Today is " + sdf.format(date) );
    }

  • How to convert an Interactive report to ALV report..please give a example..

    Hi experts,
    How to convert an interactive report to ALV report..plz suggest me an example...
    thanks in advance,
    Varsha.

    hi varsha,
    chk this link.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
    you will get good idea.
    use this FM.
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE' 
                I_callback_user_command = 'USER_COMMAND' 
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]      "create a field catlog.
                i_save                  = 'X'
           tables
                t_outtab                = it_tab        "pass the final internal table.
           exceptions
                program_error           = 1
                others                  = 2.
    Regards
    Anver

Maybe you are looking for