MVC approach VS do-everything-in-JSP approach

Posted on 2005-03-27
Medium Priority
Last Modified: 2010-04-01

I have additional question to the following program.
I made a “color preference” form that collects the user’s preferred foreground and background colors. Send the data to a JSP page that displays come message using those colors.
Now, if I prohibit the foreground and background colors from being identical, is it going to be easier with the MVC approach than it would have been with the do-everything-in-JSP approach? If so, why?

Question by:dkim18
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 13641168
'to prohibit the foreground and background colors from being identical', this really should not be a reason for you to decide whether to use MVC or JSP scriptlet solution.

Usually MVC solution is used to make a clear separation between the View (JSP) and the logic (Servlet).

It really does not matter how you solve this 'color preference' problem, whether you use do-everything-in-JSP or MVC approach, because both has its own advantage.

do-everything-in-JSP advantage:
a lot faster to code, good for a small site with only a few form processing

MVC approach
More organized approach but it require a lot of work to setup. Good if you plan to build a big site with a lot of form processing, but might be too cumbersome for a small site

Author Comment

ID: 13641255
I know that it shouldn't be a reason to decide whether to use MVC or JSP scriptlet solution. The above was assignment and it was wondering which one would be easier if I don't let a user choose same colors for background and foreground color and why.

Assisted Solution

arnon81 earned 200 total points
ID: 13641705
If someone tell me to create this 'color preference' stuff I would do it in do-everything-in-JSP approach because it is faster to code and since it doesn't require some complex/a lot of  business logic, I would just put the business logic in jsp scriptlet or maybe I could put the business logic in a java class.
But your teacher might want different answer, dunno...
LVL 29

Accepted Solution

bloodredsun earned 200 total points
ID: 13646710
For something as simple as that it makes no difference and can easily be coded in a scriptlet.

MVC is normally the best approach to use rather than layer 1 (the official name for everything-in-jsps). You could instead use layer 2 as a compromise, this is the combinatino of JSPs, servlets and javabeans. This allows you to take your logic out of the jsp but without the extra progamming effort of putting a simple chore into somehting like Struts.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
If you're a modern-day technology professional, you may be wondering if certifications are really necessary. They are. Here's why.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question