Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7965371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:08:12+00:00 2026-06-04T06:08:12+00:00

I am working on a web application which is based on spring MVC. We

  • 0

I am working on a web application which is based on spring MVC. We have various screens for adding different domain components(eg. Account details, Employee details etc). I need to implement an upload feature for each of these domain components i.e. to upload Account, upload employee details etc which will be provided in a csv file (open the file, parse its contents, validate and then persist).

My question is, which design pattern should i consider to implement such a requirement so that upload (open the file, parse its contents, validate and then persist) feature becomes generic. I was thinking about using the template design pattern. Template Pattern

Any suggestions,pointers,links would be highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:08:13+00:00Added an answer on June 4, 2026 at 6:08 am

    A strategy pattern my be useful here for the uploader. The Uploader class would be a sort of container/manager class that would simply contain a parsing attribute and a persistance attribute. Both of these attributes would be defined as an abstract base class and would have multiple implementations. Even though you say it will always be csv and oracle, this approach would be future-proof and would also separate the parsing/verifying from the persistence code.

    Here’s an example:

    class Uploader
    {
    private:
        Parser parser_;
        Persistence persistence_;
    
        void upload() {
            parser_.read();
            parser_.parse();
            parser_.validate();
            persistence_.persist(parser_.getData());
        }
    
    public:
        void setParser(Parser parser) {parser_ = parser;}
        void setPersister(Persistence persistence) {persistence_ = persistence;}
    };
    
    Class Parser
    {
        abstract void read();
        abstract void parse();
        abstract void validate();
        abstract String getData();
    };
    
    class Persistence
    {
        abstract persist(String data);
    };
    
    class CsvParser : public Parser
    {
        // implement everything here
    };
    
    // more Parser implementations as needed
    
    class DbPersistence : public Persistence
    {
        // implement everything here
    };
    
    class NwPersistence : public Persistence
    {
        // implement everything here
    };
    
    // more Persistence implementations as needed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working with the Google Web Toolkit i have written an application which is based
I'm working on a web based application which uses a JSON over HTTP based
I'm currently working on a membership system for my web application, which is based
I am working on a ASP.NET MVC 2.0 Multi-Presentation web application which would use
I am a developer working on an internal web-based application, and I have been
I have a requirement to create a web based application, which is hosted on
I'm working with integration Spring Web Flow into Spring MVC web application. I mapped
I am working on a web-based application which is deployed in the Tomcat server.
I have created an web based application through which the users can change the
I have a spring based web application MyWebapp built using maven and deployed on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.