Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MVC approach VS do-everything-in-JSP approach

Posted on 2005-03-27
4
Medium Priority
?
271 Views
Last Modified: 2010-04-01
Hi!

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?

Thanks,
0
Comment
Question by:dkim18
  • 2
4 Comments
 
LVL 2

Expert Comment

by:arnon81
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
0
 

Author Comment

by:dkim18
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.
0
 
LVL 2

Assisted Solution

by:arnon81
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...
0
 
LVL 29

Accepted Solution

by:
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.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

What happened when I tried to make my phone, a Samsung Galaxy S8, stop dropping all WiFi signals was a saga I won't repeat here, but what you might want to know is how it started and how I got it working again.
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
Screencast - Getting to Know the Pipeline
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

571 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