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

  • SEARCH
  • Home
  • 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 7541691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:57:37+00:00 2026-05-30T07:57:37+00:00

My program uses MVC. When the user hits New File, I need to check

  • 0

My program uses MVC. When the user hits “New File”, I need to check if the previous open file is edited (and prompt the user to save if so).

From what I’ve understood, the controller should solely perform all validation and logic. Is it then okay for my controller to prompt the user for file name, save previous file etc using JOptionPane? Or should all input be taken in the GUI?

Thanks!

  • 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-05-30T07:57:38+00:00Added an answer on May 30, 2026 at 7:57 am

    In the MVC pattern, “The controller receives user input and initiates a response by making calls on model objects”.

    Considering the context of your problem, especially the tasks which you mentioned:

    1. Prompt the user for file name
    2. Check whether file has been modified
    3. Save the changes, etc

    To help you better understand, I’ll tell you what task should be performed by which component.

    Your model should have logic for performing 2 and 3. And your controller should invoke (call methods on) your model and depending on the returned values invoke yet other functionality on the view, like a using JoptionPane and other such things for prompting the user for file name etc.

    So all in all, your controller should only act as a moderator and do nothing on it’s own. All the tasks you mentioned will be performed either by Model or the View. It’s the job of your controller to bring them about.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I check how much resources a java program uses? In java it
I have a program that uses the mt19937 random number generator from boost::random. I
The question An open source program uses CVS for version control. I would like
I have a phone-book program written in C++, that uses the MVC model, now
My Program uses EF to access data from a SQL CE database. When debug
Can we check if a running application or a program uses .Net framework to
My program uses wx.ProgressDialog to give feedback on a process that is in multiple
My program uses some external programs that i included in the Files folder. In
My program uses sqlite3 plus python. It works fine with python 2.6.2 I moved
If my Perl program uses Perl modules, how will it determine where to find

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.