<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pmpereir</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pmpereir"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Pmpereir"/>
	<updated>2026-10-03T19:16:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=71222</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=71222"/>
		<updated>2012-11-23T01:21:18Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade design pattern=&lt;br /&gt;
&lt;br /&gt;
==Scope==&lt;br /&gt;
This purpose of this wiki is to provide a &amp;quot;directory&amp;quot; of sites that talk about the Facade design pattern. This page describes the contents of various websites that describe the Facade pattern. A comparison of the sites based on several factors is also provided. In addition to this, several links to online video tutorials are also provided to help the reader understand the pattern better.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns at java.dzone.com]===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade Facade Patterns at sourcemaking.com] ===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Facade Pattern Tutorial at thecafetechno.com]===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Blackwasp.co.uk]===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
=== 6. [http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf Lecture Notes on Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
This document starts with the Intent for using the Facade pattern. It then goes on to describe the motivation and applicability for the pattern. The benefits and liabilities have also been mentioned towards the end. Although there is a real world example listed in this document, this document does not attempt to explain this example. Also, there is no code implementation present for this example.&lt;br /&gt;
&lt;br /&gt;
=== 7. [http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 Facade Pattern at dofactory.com]===&lt;br /&gt;
&lt;br /&gt;
This page describes a very concise introduction to the Facade pattern. The author explains a brief overview of the pattern and it's usage using UML diagrams. The highlight of the article is a with an explanatory example and then a much more detailed real world example.&lt;br /&gt;
&lt;br /&gt;
=== 8. [http://www.theperlreview.com/Articles/v0i4/facade.pdf Facade Pattern at theperlreview.com] ===&lt;br /&gt;
&lt;br /&gt;
This paper is a scholarly article from the e-magazine &amp;quot;The Perl Review&amp;quot; [http://www.theperlreview.com/] by Brian D. Foy. The article entails how the facade pattern is used to promote reusability and to use facades as objects. The article illustrates two different types of implementing the facade pattern - adhoc facades and apriori facades. There are sufficient examples to explain each subsection and all the code samples are in Perl.&lt;br /&gt;
&lt;br /&gt;
=== 9. [http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade Structural Facades]===&lt;br /&gt;
&lt;br /&gt;
This is an extremely well detailed article that covers a wide variety of aspects ranging from technical definitions to actual real world implications of the facade pattern. It explains the pattern's complexities and intricacies with the help of well defined UML diagrams and actual pseudo-code to convey the idea as lucidly as possible. The article also provides with downloads of sample VB projects using the facade pattern.&lt;br /&gt;
&lt;br /&gt;
=== 10. [http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article details the Facade pattern and how it fixes real world problems like code in legacy system. It explains with lucid diagrams and illustrations how refactoring old, legacy code are fixed with facades. However, the only shortcoming is that it doesn't have actual code blocks to explain the concepts.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern by Zane Academy] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern by Mike Abyss]===&lt;br /&gt;
&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 Facade Design Pattern - Course C# 4.0 by Ayad Boudiah] ===&lt;br /&gt;
&lt;br /&gt;
This video is from a series of design patterns tutorials using coded samples in C#. It is a step by step screencast that tries to explain the actual working of the facade pattern with a simple example.&lt;br /&gt;
&lt;br /&gt;
=== 4. [https://www.youtube.com/watch?v=B1Y8fcYrz5o Facade Design Pattern by Derek Banas] ===&lt;br /&gt;
&lt;br /&gt;
This video describes a step by step approach to implement the facade pattern with the help of a real world bank account example. The narrator has provided with links to the code in the description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Directory of Sites''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Sites&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikipedia.org/wiki/Facade_pattern #1]&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
|-&lt;br /&gt;
! [http://java.dzone.com/articles/design-patterns-uncovered-1 #2]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://sourcemaking.com/design_patterns/facade #3]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ #4] &lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.blackwasp.co.uk/Facade.aspx #5]&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf #6]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 #7]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.theperlreview.com/Articles/v0i4/facade.pdf #8]&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade #9]&lt;br /&gt;
! ****&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern #10]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Videos''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Videos&lt;br /&gt;
! Language&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.youtube.com/watch?v=wFOCmN5zNHA #1]&lt;br /&gt;
! Java&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related #2]&lt;br /&gt;
! C#&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 #3]&lt;br /&gt;
! C#&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [https://www.youtube.com/watch?v=B1Y8fcYrz5o #4]&lt;br /&gt;
! Java&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;br /&gt;
# http://www.theperlreview.com/&lt;br /&gt;
# http://en.wikipedia.org/wiki/Facade_pattern&lt;br /&gt;
# http://userpages.umbc.edu/~tarr/dp/lectures/&lt;br /&gt;
# http://www.dofactory.com/Default.aspx&lt;br /&gt;
# http://www.headfirstlabs.com/books/hfdp/&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70963</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70963"/>
		<updated>2012-11-20T00:39:20Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. http://java.dzone.com/articles/design-patterns-uncovered-1===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. http://sourcemaking.com/design_patterns/facade===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. http://www.blackwasp.co.uk/Facade.aspx===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
=== 6. http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This document starts with the Intent for using the Facade pattern. It then goes on to describe the motivation and applicability for the pattern. The benefits and liabilities have also been mentioned towards the end. Although there is a real world example listed in this document, this document does not attempt to explain this example. Also, there is no code implementation present for this example.&lt;br /&gt;
&lt;br /&gt;
=== 7. http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 ===&lt;br /&gt;
&lt;br /&gt;
This page describes a very concise introduction to the Facade pattern. The author explains a brief overview of the pattern and it's usage using UML diagrams. The highlight of the article is a with an explanatory example and then a much more detailed real world example.&lt;br /&gt;
&lt;br /&gt;
=== 8. http://www.theperlreview.com/Articles/v0i4/facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This paper is a scholarly article from the e-magazine &amp;quot;The Perl Review&amp;quot; [http://www.theperlreview.com/] by Brian D. Foy. The article entails how the facade pattern is used to promote reusability and to use facades as objects. The article illustrates two different types of implementing the facade pattern - adhoc facades and apriori facades. There are sufficient examples to explain each subsection and all the code samples are in Perl. &lt;br /&gt;
&lt;br /&gt;
=== 9. http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade ===&lt;br /&gt;
&lt;br /&gt;
This is an extremely well detailed article that covers a wide variety of aspects ranging from technical definitions to actual real world implications of the facade pattern. It explains the pattern's complexities and intricacies with the help of well defined UML diagrams and actual pseudo-code to convey the idea as lucidly as possible. The article also provides with downloads of sample VB projects using the facade pattern. &lt;br /&gt;
&lt;br /&gt;
=== 10. http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern ===&lt;br /&gt;
&lt;br /&gt;
This article details the Facade pattern and how it fixes real world problems like code in legacy system. It explains with lucid diagrams and illustrations how refactoring old, legacy code are fixed with facades. However, the only shortcoming is that it doesn't have actual code blocks to explain the concepts.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern by Zane Academy] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern by Mike Abyss]===&lt;br /&gt;
&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 Facade Design Pattern - Course C# 4.0 by Ayad Boudiah] ===&lt;br /&gt;
&lt;br /&gt;
This video is from a series of design patterns tutorials using coded samples in C#. It is a step by step screencast that tries to explain the actual working of the facade pattern with a simple example.&lt;br /&gt;
&lt;br /&gt;
=== 4. [https://www.youtube.com/watch?v=B1Y8fcYrz5o Facade Design Pattern by Derek Banas] ===&lt;br /&gt;
&lt;br /&gt;
This video describes a step by step approach to implement the facade pattern with the help of a real world bank account example. The narrator has provided with links to the code in the description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Directory of Sites''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Sites&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikipedia.org/wiki/Facade_pattern #1]&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
|-&lt;br /&gt;
! [http://java.dzone.com/articles/design-patterns-uncovered-1 #2]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://sourcemaking.com/design_patterns/facade #3]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ #4] &lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.blackwasp.co.uk/Facade.aspx #5]&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf #6]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 #7]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.theperlreview.com/Articles/v0i4/facade.pdf #8]&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade #9]&lt;br /&gt;
! ****&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern #10]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Videos''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Videos&lt;br /&gt;
! Language&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.youtube.com/watch?v=wFOCmN5zNHA #1]&lt;br /&gt;
! Java&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related #2]&lt;br /&gt;
! C#&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 #3]&lt;br /&gt;
! C#&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [https://www.youtube.com/watch?v=B1Y8fcYrz5o #4]&lt;br /&gt;
! Java&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;br /&gt;
# http://www.theperlreview.com/&lt;br /&gt;
# http://en.wikipedia.org/wiki/Facade_pattern&lt;br /&gt;
# http://userpages.umbc.edu/~tarr/dp/lectures/&lt;br /&gt;
# http://www.dofactory.com/Default.aspx&lt;br /&gt;
# http://www.headfirstlabs.com/books/hfdp/&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70878</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70878"/>
		<updated>2012-11-19T23:13:13Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Comparison of Videos */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. http://java.dzone.com/articles/design-patterns-uncovered-1===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. http://sourcemaking.com/design_patterns/facade===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. http://www.blackwasp.co.uk/Facade.aspx===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
=== 6. http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This document starts with the Intent for using the Facade pattern. It then goes on to describe the motivation and applicability for the pattern. The benefits and liabilities have also been mentioned towards the end. Although there is a real world example listed in this document, this document does not attempt to explain this example. Also, there is no code implementation present for this example.&lt;br /&gt;
&lt;br /&gt;
=== 7. http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 ===&lt;br /&gt;
&lt;br /&gt;
This page describes a very concise introduction to the Facade pattern. The author explains a brief overview of the pattern and it's usage using UML diagrams. The highlight of the article is a with an explanatory example and then a much more detailed real world example.&lt;br /&gt;
&lt;br /&gt;
=== 8. http://www.theperlreview.com/Articles/v0i4/facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This paper is a scholarly article from the e-magazine &amp;quot;The Perl Review&amp;quot; [http://www.theperlreview.com/] by Brian D. Foy. The article entails how the facade pattern is used to promote reusability and to use facades as objects. The article illustrates two different types of implementing the facade pattern - adhoc facades and apriori facades. There are sufficient examples to explain each subsection and all the code samples are in Perl. &lt;br /&gt;
&lt;br /&gt;
=== 9. http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade ===&lt;br /&gt;
&lt;br /&gt;
This is an extremely well detailed article that covers a wide variety of aspects ranging from technical definitions to actual real world implications of the facade pattern. It explains the pattern's complexities and intricacies with the help of well defined UML diagrams and actual pseudo-code to convey the idea as lucidly as possible. The article also provides with downloads of sample VB projects using the facade pattern. &lt;br /&gt;
&lt;br /&gt;
=== 10. http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern ===&lt;br /&gt;
&lt;br /&gt;
This article details the Facade pattern and how it fixes real world problems like code in legacy system. It explains with lucid diagrams and illustrations how refactoring old, legacy code are fixed with facades. However, the only shortcoming is that it doesn't have actual code blocks to explain the concepts.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern by Zane Academy] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern by Mike Abyss]===&lt;br /&gt;
&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 Facade Design Pattern - Course C# 4.0 by Ayad Boudiah] ===&lt;br /&gt;
&lt;br /&gt;
This video is from a series of design patterns tutorials using coded samples in C#. It is a step by step screencast that tries to explain the actual working of the facade pattern with a simple example.&lt;br /&gt;
&lt;br /&gt;
=== 4. [https://www.youtube.com/watch?v=B1Y8fcYrz5o Facade Design Pattern by Derek Banas] ===&lt;br /&gt;
&lt;br /&gt;
This video describes a step by step approach to implement the facade pattern with the help of a real world bank account example. The narrator has provided with links to the code in the description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Directory of Sites''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Sites&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikipedia.org/wiki/Facade_pattern #1]&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
|-&lt;br /&gt;
! [http://java.dzone.com/articles/design-patterns-uncovered-1 #2]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://sourcemaking.com/design_patterns/facade #3]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ #4] &lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.blackwasp.co.uk/Facade.aspx #5]&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf #6]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 #7]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.theperlreview.com/Articles/v0i4/facade.pdf #8]&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade #9]&lt;br /&gt;
! ****&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern #10]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Videos''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Videos&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Pseudo-Code&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.youtube.com/watch?v=wFOCmN5zNHA #1]&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related #2]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 #3]&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [https://www.youtube.com/watch?v=B1Y8fcYrz5o #4]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;br /&gt;
# http://www.theperlreview.com/&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70873</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70873"/>
		<updated>2012-11-19T23:12:11Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Comparison of Directory of Sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. http://java.dzone.com/articles/design-patterns-uncovered-1===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. http://sourcemaking.com/design_patterns/facade===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. http://www.blackwasp.co.uk/Facade.aspx===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
=== 6. http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This document starts with the Intent for using the Facade pattern. It then goes on to describe the motivation and applicability for the pattern. The benefits and liabilities have also been mentioned towards the end. Although there is a real world example listed in this document, this document does not attempt to explain this example. Also, there is no code implementation present for this example.&lt;br /&gt;
&lt;br /&gt;
=== 7. http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 ===&lt;br /&gt;
&lt;br /&gt;
This page describes a very concise introduction to the Facade pattern. The author explains a brief overview of the pattern and it's usage using UML diagrams. The highlight of the article is a with an explanatory example and then a much more detailed real world example.&lt;br /&gt;
&lt;br /&gt;
=== 8. http://www.theperlreview.com/Articles/v0i4/facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This paper is a scholarly article from the e-magazine &amp;quot;The Perl Review&amp;quot; [http://www.theperlreview.com/] by Brian D. Foy. The article entails how the facade pattern is used to promote reusability and to use facades as objects. The article illustrates two different types of implementing the facade pattern - adhoc facades and apriori facades. There are sufficient examples to explain each subsection and all the code samples are in Perl. &lt;br /&gt;
&lt;br /&gt;
=== 9. http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade ===&lt;br /&gt;
&lt;br /&gt;
This is an extremely well detailed article that covers a wide variety of aspects ranging from technical definitions to actual real world implications of the facade pattern. It explains the pattern's complexities and intricacies with the help of well defined UML diagrams and actual pseudo-code to convey the idea as lucidly as possible. The article also provides with downloads of sample VB projects using the facade pattern. &lt;br /&gt;
&lt;br /&gt;
=== 10. http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern ===&lt;br /&gt;
&lt;br /&gt;
This article details the Facade pattern and how it fixes real world problems like code in legacy system. It explains with lucid diagrams and illustrations how refactoring old, legacy code are fixed with facades. However, the only shortcoming is that it doesn't have actual code blocks to explain the concepts.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern by Zane Academy] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern by Mike Abyss]===&lt;br /&gt;
&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 Facade Design Pattern - Course C# 4.0 by Ayad Boudiah] ===&lt;br /&gt;
&lt;br /&gt;
This video is from a series of design patterns tutorials using coded samples in C#. It is a step by step screencast that tries to explain the actual working of the facade pattern with a simple example.&lt;br /&gt;
&lt;br /&gt;
=== 4. [https://www.youtube.com/watch?v=B1Y8fcYrz5o Facade Design Pattern by Derek Banas] ===&lt;br /&gt;
&lt;br /&gt;
This video describes a step by step approach to implement the facade pattern with the help of a real world bank account example. The narrator has provided with links to the code in the description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Directory of Sites''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Sites&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikipedia.org/wiki/Facade_pattern #1]&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
|-&lt;br /&gt;
! [http://java.dzone.com/articles/design-patterns-uncovered-1 #2]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://sourcemaking.com/design_patterns/facade #3]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ #4] &lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.blackwasp.co.uk/Facade.aspx #5]&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf #6]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 #7]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.theperlreview.com/Articles/v0i4/facade.pdf #8]&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade #9]&lt;br /&gt;
! ****&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern #10]&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Videos''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Videos&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Pseudo-Code&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! Video 1&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 2&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 3&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 4&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;br /&gt;
# http://www.theperlreview.com/&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70872</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70872"/>
		<updated>2012-11-19T23:10:03Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Comparison of Directory of Sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. http://java.dzone.com/articles/design-patterns-uncovered-1===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. http://sourcemaking.com/design_patterns/facade===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. http://www.blackwasp.co.uk/Facade.aspx===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
=== 6. http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This document starts with the Intent for using the Facade pattern. It then goes on to describe the motivation and applicability for the pattern. The benefits and liabilities have also been mentioned towards the end. Although there is a real world example listed in this document, this document does not attempt to explain this example. Also, there is no code implementation present for this example.&lt;br /&gt;
&lt;br /&gt;
=== 7. http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 ===&lt;br /&gt;
&lt;br /&gt;
This page describes a very concise introduction to the Facade pattern. The author explains a brief overview of the pattern and it's usage using UML diagrams. The highlight of the article is a with an explanatory example and then a much more detailed real world example.&lt;br /&gt;
&lt;br /&gt;
=== 8. http://www.theperlreview.com/Articles/v0i4/facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This paper is a scholarly article from the e-magazine &amp;quot;The Perl Review&amp;quot; [http://www.theperlreview.com/] by Brian D. Foy. The article entails how the facade pattern is used to promote reusability and to use facades as objects. The article illustrates two different types of implementing the facade pattern - adhoc facades and apriori facades. There are sufficient examples to explain each subsection and all the code samples are in Perl. &lt;br /&gt;
&lt;br /&gt;
=== 9. http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade ===&lt;br /&gt;
&lt;br /&gt;
This is an extremely well detailed article that covers a wide variety of aspects ranging from technical definitions to actual real world implications of the facade pattern. It explains the pattern's complexities and intricacies with the help of well defined UML diagrams and actual pseudo-code to convey the idea as lucidly as possible. The article also provides with downloads of sample VB projects using the facade pattern. &lt;br /&gt;
&lt;br /&gt;
=== 10. http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern ===&lt;br /&gt;
&lt;br /&gt;
This article details the Facade pattern and how it fixes real world problems like code in legacy system. It explains with lucid diagrams and illustrations how refactoring old, legacy code are fixed with facades. However, the only shortcoming is that it doesn't have actual code blocks to explain the concepts.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern by Zane Academy] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern by Mike Abyss]===&lt;br /&gt;
&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 Facade Design Pattern - Course C# 4.0 by Ayad Boudiah] ===&lt;br /&gt;
&lt;br /&gt;
This video is from a series of design patterns tutorials using coded samples in C#. It is a step by step screencast that tries to explain the actual working of the facade pattern with a simple example.&lt;br /&gt;
&lt;br /&gt;
=== 4. [https://www.youtube.com/watch?v=B1Y8fcYrz5o Facade Design Pattern by Derek Banas] ===&lt;br /&gt;
&lt;br /&gt;
This video describes a step by step approach to implement the facade pattern with the help of a real world bank account example. The narrator has provided with links to the code in the description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Directory of Sites''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Sites&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikipedia.org/wiki/Facade_pattern #1]&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
|-&lt;br /&gt;
! [http://java.dzone.com/articles/design-patterns-uncovered-1 #2]&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 3&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 4&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 5&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 6&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 7&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 8&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 9&lt;br /&gt;
! ****&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Site 10&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Videos''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Videos&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Pseudo-Code&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! Video 1&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 2&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 3&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 4&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;br /&gt;
# http://www.theperlreview.com/&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70869</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70869"/>
		<updated>2012-11-19T23:06:40Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. http://java.dzone.com/articles/design-patterns-uncovered-1===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. http://sourcemaking.com/design_patterns/facade===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. http://www.blackwasp.co.uk/Facade.aspx===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
=== 6. http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This document starts with the Intent for using the Facade pattern. It then goes on to describe the motivation and applicability for the pattern. The benefits and liabilities have also been mentioned towards the end. Although there is a real world example listed in this document, this document does not attempt to explain this example. Also, there is no code implementation present for this example.&lt;br /&gt;
&lt;br /&gt;
=== 7. http://www.dofactory.com/Patterns/PatternFacade.aspx#_self2 ===&lt;br /&gt;
&lt;br /&gt;
This page describes a very concise introduction to the Facade pattern. The author explains a brief overview of the pattern and it's usage using UML diagrams. The highlight of the article is a with an explanatory example and then a much more detailed real world example.&lt;br /&gt;
&lt;br /&gt;
=== 8. http://www.theperlreview.com/Articles/v0i4/facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This paper is a scholarly article from the e-magazine &amp;quot;The Perl Review&amp;quot; [http://www.theperlreview.com/] by Brian D. Foy. The article entails how the facade pattern is used to promote reusability and to use facades as objects. The article illustrates two different types of implementing the facade pattern - adhoc facades and apriori facades. There are sufficient examples to explain each subsection and all the code samples are in Perl. &lt;br /&gt;
&lt;br /&gt;
=== 9. http://www.programmersheaven.com/2/Tutorial-Design-Patterns-Structural-Facade ===&lt;br /&gt;
&lt;br /&gt;
This is an extremely well detailed article that covers a wide variety of aspects ranging from technical definitions to actual real world implications of the facade pattern. It explains the pattern's complexities and intricacies with the help of well defined UML diagrams and actual pseudo-code to convey the idea as lucidly as possible. The article also provides with downloads of sample VB projects using the facade pattern. &lt;br /&gt;
&lt;br /&gt;
=== 10. http://www.netobjectivestest.com/PatternRepository/index.php?title=TheFacadePattern ===&lt;br /&gt;
&lt;br /&gt;
This article details the Facade pattern and how it fixes real world problems like code in legacy system. It explains with lucid diagrams and illustrations how refactoring old, legacy code are fixed with facades. However, the only shortcoming is that it doesn't have actual code blocks to explain the concepts.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern by Zane Academy] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern by Mike Abyss]===&lt;br /&gt;
&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://mrbool.com/facade-design-pattern-course-c-4-0-lesson-23/18691 Facade Design Pattern - Course C# 4.0 by Ayad Boudiah] ===&lt;br /&gt;
&lt;br /&gt;
This video is from a series of design patterns tutorials using coded samples in C#. It is a step by step screencast that tries to explain the actual working of the facade pattern with a simple example.&lt;br /&gt;
&lt;br /&gt;
=== 4. [https://www.youtube.com/watch?v=B1Y8fcYrz5o Facade Design Pattern by Derek Banas] ===&lt;br /&gt;
&lt;br /&gt;
This video describes a step by step approach to implement the facade pattern with the help of a real world bank account example. The narrator has provided with links to the code in the description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Directory of Sites''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Sites&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikipedia.org/wiki/Facade_pattern Site 1]&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
|-&lt;br /&gt;
! Site 2&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 3&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 4&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 5&lt;br /&gt;
! *****&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 6&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 7&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ***&lt;br /&gt;
! ***&lt;br /&gt;
! &lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 8&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! &lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
|-&lt;br /&gt;
! Site 9&lt;br /&gt;
! ****&lt;br /&gt;
! **&lt;br /&gt;
! ***&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Site 10&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== '''Comparison of Videos''' ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;font-size: 120%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sites|Videos&lt;br /&gt;
! Simplicity&lt;br /&gt;
! Content Structure&lt;br /&gt;
! Comparison with related patterns&lt;br /&gt;
! Usage Guidance&lt;br /&gt;
! Pseudo-Code&lt;br /&gt;
! Coded Examples&lt;br /&gt;
! Real World Examples&lt;br /&gt;
! Advantages and Disadvantages&lt;br /&gt;
|-&lt;br /&gt;
! Video 1&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 2&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 3&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
! ****&lt;br /&gt;
|-&lt;br /&gt;
! Video 4&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! *****&lt;br /&gt;
! ****&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;br /&gt;
# http://www.theperlreview.com/&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70513</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70513"/>
		<updated>2012-11-19T04:41:19Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Directory of Sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. http://java.dzone.com/articles/design-patterns-uncovered-1===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. http://sourcemaking.com/design_patterns/facade===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. http://www.blackwasp.co.uk/Facade.aspx===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
=== 6. http://userpages.umbc.edu/~tarr/dp/lectures/Facade.pdf ===&lt;br /&gt;
&lt;br /&gt;
This document starts with the Intent for using the Facade pattern. It then goes on to describe the motivation and applicability for the pattern. The benefits and liabilities have also been mentioned towards the end. Although there is a real world example listed in this document, this document does not attempt to explain this example. Also, there is no code implementation present for this example.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70508</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70508"/>
		<updated>2012-11-19T04:37:12Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. http://java.dzone.com/articles/design-patterns-uncovered-1===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. http://sourcemaking.com/design_patterns/facade===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. http://www.blackwasp.co.uk/Facade.aspx===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70434</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70434"/>
		<updated>2012-11-19T01:21:41Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 5. Facade design pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
This article describes the ideal usage of the facade pattern and the advantages of this pattern. It also gives a real world example where this pattern is used which gives the reader a better idea about the pattern. There is a generic UML diagram and code example for implementing this pattern. One of the shortcomings of this article is that it doesn't use a practical example for the implementation and only gives a very generic, high-level implementation.&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70430</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70430"/>
		<updated>2012-11-19T01:17:56Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 4. Thecafetechno : Facade Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
This page describes the need for using the facade pattern. It also has a good code example for the pattern which is easy to understand. An important section of this article is that it gives several scenarios where the facade pattern could be used. The conclusion describes the advantages of the pattern. An important section that is missing is a comparison with other similar patterns.&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70426</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70426"/>
		<updated>2012-11-19T01:08:36Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 3. SourceMaking : Facade Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article separates the description into several well defined sections which provide a good overall understanding to the reader. The article starts with the need for this pattern and then goes on to describe the pattern pattern with an simple real life example. It also provides a 'Checklist' to guide the developer in implementing the pattern. Subtle differences between Adapter and Facade pattern are also mentioned. A very attractive part of this article is that there are code examples provides for different languages like C#, C++, Delphi, Java and PHP.&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70416</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70416"/>
		<updated>2012-11-19T00:58:23Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 2. Design Patterns Uncovered: The Facade Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70415</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70415"/>
		<updated>2012-11-19T00:58:02Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 2. Design Patterns Uncovered: The Facade Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
This article is well-structured and starts with a real world example of the facade pattern. It also specifies similarities with the Adapter pattern in it's description. It's also tells the reader when to use this pattern along with a sequence diagram of the pattern. Finally, it provides a facade pattern code example in Java. This example also has comments to help the reader in understanding the code. The disadvantages of using this pattern are also described towards the end of the article.&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70411</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70411"/>
		<updated>2012-11-19T00:53:47Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 1. Facade pattern (Wikipedia) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Adapter is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70408</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70408"/>
		<updated>2012-11-19T00:52:51Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 1. Facade pattern (Wikipedia) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
This page talks about the usage of the facade pattern. There is also a code example in Java describing the pattern.&lt;br /&gt;
Although this page attempts to describe the facade pattern and also has a code example, there is very limited content on the pattern itself. This page does not specify the advantages and disadvantages of using this pattern. Also, there is no mention of the scenarios in which this pattern could be used. A comparison with other similar patterns like Decorator is also missing.&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70406</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70406"/>
		<updated>2012-11-19T00:45:13Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Facade, directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following list of sites and online videos provide information about the Facade pattern, including the implementation.&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70395</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70395"/>
		<updated>2012-11-19T00:33:53Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Directory of Sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
== Video tutorials on Facade pattern ==&lt;br /&gt;
&lt;br /&gt;
=== 1. [http://www.youtube.com/watch?v=wFOCmN5zNHA JAVA: Facade Design Pattern] ===&lt;br /&gt;
&lt;br /&gt;
This video talks about the Facade design pattern along with the UML diagram and facade pattern implementation examples from the JDK. It also talks about the advantages and the scenarios in which this pattern can be used.&lt;br /&gt;
&lt;br /&gt;
== 2. [http://www.youtube.com/watch?v=WLjvNpP6yeQ&amp;amp;feature=related Facade pattern]==&lt;br /&gt;
This video explains the Facade pattern in detail along with a walk through of the code example. The link to the code is also provided in the video description.&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70388</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70388"/>
		<updated>2012-11-19T00:16:56Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 4. thecafetechno : Facade Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ Thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70387</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70387"/>
		<updated>2012-11-19T00:16:38Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Directory of Sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 3. [http://sourcemaking.com/design_patterns/facade SourceMaking : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 4. [http://thecafetechno.com/tutorials/design-patterns/facade-pattern-in-java/ thecafetechno : Facade Design Pattern]===&lt;br /&gt;
&lt;br /&gt;
=== 5. [http://www.blackwasp.co.uk/Facade.aspx Facade design pattern]===&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70382</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70382"/>
		<updated>2012-11-19T00:07:03Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Directory of Sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== 1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
=== 2. [http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70381</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70381"/>
		<updated>2012-11-19T00:06:37Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Directory of Sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
=== # [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
=== #[http://java.dzone.com/articles/design-patterns-uncovered-1 Design Patterns Uncovered: The Facade Pattern]===&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70379</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70379"/>
		<updated>2012-11-19T00:04:53Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* 1. Facade pattern (Wikipedia) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
===1. [http://en.wikipedia.org/wiki/Facade_pattern Facade pattern (Wikipedia)]===&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70377</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70377"/>
		<updated>2012-11-19T00:03:26Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;br /&gt;
==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/GOF GoF] definition for facade design pattern is, &amp;quot;Provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Directory of Sites==&lt;br /&gt;
===1. Facade pattern (Wikipedia)===&lt;br /&gt;
&lt;br /&gt;
http://en.wikipedia.org/wiki/Facade_pattern&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Comparison ==&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
# http://en.wikipedia.org/wiki/GOF&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70353</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 1w61 ps</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_1w61_ps&amp;diff=70353"/>
		<updated>2012-11-18T22:00:38Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: Created page with &amp;quot;=Facade, directory of sites=&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Facade, directory of sites=&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=70352</id>
		<title>CSC/ECE 517 Fall 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=70352"/>
		<updated>2012-11-18T21:59:40Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE_517_Fall_2012/Table_Of_Contents]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 n xx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w1 rk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w20 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w5 su]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w6 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w4 aj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w7 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w8 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w9 av]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w10 pk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w11 ap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w12 mv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w14 gv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w17 ir]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w18 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w22 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 wi]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w31 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w16 br]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w23 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w24 nr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w15 rt]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w3 pl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w32 cm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w5 dp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w37 ss]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w67 ks]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w27 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w29 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w33 op]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w19 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w34 vd]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w35 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w30 rp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w58 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w47 sk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w69 mv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w44 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w45 is]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w53 kc]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w40 ar]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w39 sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w54 go]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w56 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w64 nn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w66 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w40 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w42 js]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w46 sm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w71 gs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w63 dv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w55 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w57 mp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w52 an]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch1b 1w38 nm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w60 ac]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w62 rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w29 st]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w3_sm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w30 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w17 pt]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w31 up]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w9 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w19 is]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w26 aj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w5 dp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w16 dp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w8 vp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w18 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w3 jm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w23 sr]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w11_aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w15 rr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w33 pv]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w20_aa]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w14_bb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w21_ap]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w13_sm]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w4_sa]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w25_nr]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w12_sv]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w7_ma]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w6_ar]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w32_mk]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2a_2w10_rc]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w70_sm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w67_sk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w40_sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w22_sk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w-1w65_am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w59_bc]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w60_ns]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b 2w47 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w69_as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w39_ka]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w36_av]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w37_ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w43_iv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w53_iv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w63_sp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w49_ps]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w52_sj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2b_2w28_dh]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 2w41 dc]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2b_1w59_nm]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch2b_1w61_ps]]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65315</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65315"/>
		<updated>2012-09-20T00:27:16Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to [http://en.wikipedia.org/wiki/Trygve_Reenskaug Trygve Reenskaug], who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model, the view is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==Previous research in MVC==&lt;br /&gt;
&lt;br /&gt;
The MVC framework is a well-established design pattern that is widely used for applications with a user interface component.  Several papers describe applications of the MVC framework for Web application development.  For example, GuangChun et al. (13) describe an approach whereby the model component is a JavaBean, the View is created using Java Server Pages (JSPs), and the Controller is created using a Java servlet.  Leff and Rayfield (14) describe an MVC Web application that provides flexibility in how the application is partitioned between the client and the server.  Sauter et. al (15) describe an MVC application that adapts to multiple client devices, including computers, printers, and handheld devices.&lt;br /&gt;
&lt;br /&gt;
A number of proprietary Web-oriented technologies have been developed using MVC, including [http://struts.apache.org/ Struts] and [http://mav.sourceforge.net/ Maverick].  Barrett and Delany (16) describe a non-proprietary MVC framework using XML and XSLTs.  &lt;br /&gt;
&lt;br /&gt;
The consensus among most authors is that the MVC framework provides significant advantages for Web based applications:  less coupling, higher cohesion, easier maintenance, and enhanced scalability.  Selfa et. al (17) state that MVC provides an added advantage for systems with a database component because it allows the same information to be presented in a variety of different formats by utilizing different information views.  (It should be noted that the system developed by Selfa et. al was developed using ASP.NET, which uses a separate controller for each of the views in the Web site.   This is a deviation from the standard MVC architecture, which prescribes a single controller for all views.)  None of this work substantiates the advantages of the MVC architecture using specific comparisons between MVC and non-MVC Web applications that systematically identify the advantages and disadvantages of each approach.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
===[http://rubyonrails.org/ Ruby on Rails]===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model ( [http://api.rubyonrails.org/classes/ActiveRecord/Base.html ActiveRecord] ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( [http://api.rubyonrails.org/classes/ActionView/Base.html ActionView] )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like [http://en.wikipedia.org/wiki/JavaServer_Pages JSP], [http://en.wikipedia.org/wiki/Active_Server_Pages ASP], [http://en.wikipedia.org/wiki/PHP PHP] and very easy to integrate with [http://en.wikipedia.org/wiki/Ajax_(programming) AJAX] technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( [http://api.rubyonrails.org/classes/ActionController/Base.html ActionController] ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
===[http://jakarta.apache.org/struts/index.html Struts framework]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Enterprise_JavaBeans Enterprise JavaBeans], [http://en.wikipedia.org/wiki/Java_Data_Objects Java Data Objects(JDO)] and [http://en.wikipedia.org/wiki/JavaBeans JavaBeans] can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of [http://struts.apache.org/1.x/apidocs/org/apache/struts/action/ActionMapping.html ActionMappings]. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Spring_Framework '''Spring framework''']===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
 &lt;br /&gt;
The example is a page displaying a car list.&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
Model classes: Car and Brand&lt;br /&gt;
Manager class: to obtain a list of Cars&lt;br /&gt;
Controller class: will use the list method from the Manager&lt;br /&gt;
View (JSP): display the car list&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
The Brand class serves as a Model class and has the information for id, name and country for the brand.&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The Car class is another Model which has information for the brand, model and price of the car.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The CarManager contains the list of Cars.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
The CarListController will use the list method from the CarManager.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This displays the list of cars along with the brand, model and price.&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/JavaServer_Faces Java Server Faces(JSF)]===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/JavaServer_Faces JSF] is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
A JSF application run in a standard web container, for example Tomcat or Jetty.&lt;br /&gt;
&lt;br /&gt;
A JSF application consists of web pages with JSF UI components. A JSF application requires also some configuration files (&amp;quot;faces-config.xml&amp;quot; and web.xml).&lt;br /&gt;
&lt;br /&gt;
The faces-config.xml defines:&lt;br /&gt;
&lt;br /&gt;
Managed Bean - the data elements of the JSF application (managed beans and backing beans) Represents a Java class which will be created dynamically during runtime of the JSF application. It can be defined for which scope the bean is valid (Session, Request, Application or none).&lt;br /&gt;
&lt;br /&gt;
the navigation between web pages&lt;br /&gt;
&lt;br /&gt;
data validators - Used to check the validity of UI input&lt;br /&gt;
&lt;br /&gt;
data converters -Used to translate between UI and model&lt;br /&gt;
&lt;br /&gt;
Managed beans are simple Java objects (POJO's) which are declared in &amp;quot;faces-config.xml&amp;quot; and can be used in an JSF application. For example you can define a Java object &amp;quot;Person&amp;quot;. Once you define the object in faces-config.xml you can use the attributes of Person in your JSF UI components, e.g. by binding the value &amp;quot;firstName&amp;quot; of this object to an JSF input field.&lt;br /&gt;
&lt;br /&gt;
JSF uses the Unified Expression Language (EL) to bind UI components to object attributes or methods.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
This is the model class that returns the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This JSP page is the view for the application and allows the user to get the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
The startup costs for MVC architectures can be high.  Newcomers to the Java-based MVC will initially face the challenge of assembling a compatible set of tag and other libraries needed for the current versions of servlet and JSP technologies.  There are also subtle but important differences in the syntax used in configuration files and tags that occur with each version of servlets, JSPs, and tag libraries.  Once these are understood, development using MVC requires writing the controller or setting up controller configuration files in Struts or JSF.  &lt;br /&gt;
&lt;br /&gt;
If you create a customized (non-Struts or JSF) MVC environment, you must train your developers in the nuances of your environment.  An advantage to using Struts or JSF over a custom MVC environment is that you can hire programmers with prior experience in these technologies.  (Other MVC frameworks exist beyond Struts and JSF, including Ruby on Rails or Tapestry.  However, the issues involved with any pre-built MVC framework, are similar to those identified for Struts and JSF.)&lt;br /&gt;
&lt;br /&gt;
After the startup costs of learning how to configure, program, and design with a selected MVC framework are realized, development time in an MVC versus a non-MVC environment is likely to be similar for small projects.  For larger projects, we anticipate MVC will be faster because the application will be more loosely coupled, have higher cohesion, and minimize intra and inter-crosscutting.  We believe a large MVC site will be more easily maintained and modified over time than a large site developed using non-MVC approaches.  &lt;br /&gt;
&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code [http://en.wikipedia.org/wiki/Don't_repeat_yourself DRY]&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;br /&gt;
&lt;br /&gt;
12. [http://www.oracle.com/technetwork/articles/javase/index-142890.html http://www.oracle.com/technetwork/articles/javase/index-142890.html]&lt;br /&gt;
&lt;br /&gt;
13. GuangChun, L., WangYanhua, Xianliang, L, and Hanhong. A Novel Web Application Frame Developed by MVC. Software Engineering Notes. 2003,  &lt;br /&gt;
Vol. 28, 2.&lt;br /&gt;
&lt;br /&gt;
14. Leff, A. and Rayfield, J.T. Web-Application Development Using the Model/View/Controller Design Pattern. IEEE XPlore. 2001.&lt;br /&gt;
&lt;br /&gt;
15. Sauter, P., Vogler, G., Specht, G., and Flor, T. A Model-View-Controller extension for pervasive multi-client user interfaces. Pers Ubiquit Comput. October, 2004.&lt;br /&gt;
&lt;br /&gt;
16. openMVC: A Non-proprietary Component-based Framework for Web Applications. Barrett, R. and Delany, S.J. New York : ACM, WWW 2004.&lt;br /&gt;
&lt;br /&gt;
17. A Database and Web Application Based on MVC Architecture. Selfa, D.M., Carrillo, M., and Rocio Boone, M. Puebla, Mexico : IEEE, IEEE Int. Conf. on Electronics, Communications, and Computers (CONIELECOMP 2006).&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65312</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65312"/>
		<updated>2012-09-20T00:18:27Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to [http://en.wikipedia.org/wiki/Trygve_Reenskaug Trygve Reenskaug], who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model, the view is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==Previous research in MVC==&lt;br /&gt;
&lt;br /&gt;
The MVC framework is a well-established design pattern that is widely used for applications with a user interface component.  Several papers describe applications of the MVC framework for Web application development.  For example, GuangChun et al. (13) describe an approach whereby the model component is a JavaBean, the View is created using Java Server Pages (JSPs), and the Controller is created using a Java servlet.  Leff and Rayfield (14) describe an MVC Web application that provides flexibility in how the application is partitioned between the client and the server.  Sauter et. al (15) describe an MVC application that adapts to multiple client devices, including computers, printers, and handheld devices.&lt;br /&gt;
&lt;br /&gt;
A number of proprietary Web-oriented technologies have been developed using MVC, including [http://struts.apache.org/ Struts] and [http://mav.sourceforge.net/ Maverick].  Barrett and Delany (16) describe a non-proprietary MVC framework using XML and XSLTs.  &lt;br /&gt;
&lt;br /&gt;
The consensus among most authors is that the MVC framework provides significant advantages for Web based applications:  less coupling, higher cohesion, easier maintenance, and enhanced scalability.  Selfa et. al (17) state that MVC provides an added advantage for systems with a database component because it allows the same information to be presented in a variety of different formats by utilizing different information views.  (It should be noted that the system developed by Selfa et. al was developed using ASP.NET, which uses a separate controller for each of the views in the Web site.   This is a deviation from the standard MVC architecture, which prescribes a single controller for all views.)  None of this work substantiates the advantages of the MVC architecture using specific comparisons between MVC and non-MVC Web applications that systematically identify the advantages and disadvantages of each approach.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
===[http://rubyonrails.org/ Ruby on Rails]===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model ( [http://api.rubyonrails.org/classes/ActiveRecord/Base.html ActiveRecord] ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( [http://api.rubyonrails.org/classes/ActionView/Base.html ActionView] )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like [http://en.wikipedia.org/wiki/JavaServer_Pages JSP], [http://en.wikipedia.org/wiki/Active_Server_Pages ASP], [http://en.wikipedia.org/wiki/PHP PHP] and very easy to integrate with [http://en.wikipedia.org/wiki/Ajax_(programming) AJAX] technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( [http://api.rubyonrails.org/classes/ActionController/Base.html ActionController] ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
===[http://jakarta.apache.org/struts/index.html Struts framework]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Enterprise_JavaBeans Enterprise JavaBeans], [http://en.wikipedia.org/wiki/Java_Data_Objects Java Data Objects(JDO)] and [http://en.wikipedia.org/wiki/JavaBeans JavaBeans] can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of [http://struts.apache.org/1.x/apidocs/org/apache/struts/action/ActionMapping.html ActionMappings]. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code [http://en.wikipedia.org/wiki/Don't_repeat_yourself DRY]&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Spring_Framework '''Spring framework''']===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
 &lt;br /&gt;
The example is a page displaying a car list.&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
Model classes: Car and Brand&lt;br /&gt;
Manager class: to obtain a list of Cars&lt;br /&gt;
Controller class: will use the list method from the Manager&lt;br /&gt;
View (JSP): display the car list&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
The Brand class serves as a Model class and has the information for id, name and country for the brand.&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The Car class is another Model which has information for the brand, model and price of the car.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The CarManager contains the list of Cars.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
The CarListController will use the list method from the CarManager.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This displays the list of cars along with the brand, model and price.&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/JavaServer_Faces Java Server Faces(JSF)]===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/JavaServer_Faces JSF] is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
A JSF application run in a standard web container, for example Tomcat or Jetty.&lt;br /&gt;
&lt;br /&gt;
A JSF application consists of web pages with JSF UI components. A JSF application requires also some configuration files (&amp;quot;faces-config.xml&amp;quot; and web.xml).&lt;br /&gt;
&lt;br /&gt;
The faces-config.xml defines:&lt;br /&gt;
&lt;br /&gt;
Managed Bean - the data elements of the JSF application (managed beans and backing beans) Represents a Java class which will be created dynamically during runtime of the JSF application. It can be defined for which scope the bean is valid (Session, Request, Application or none).&lt;br /&gt;
&lt;br /&gt;
the navigation between web pages&lt;br /&gt;
&lt;br /&gt;
data validators - Used to check the validity of UI input&lt;br /&gt;
&lt;br /&gt;
data converters -Used to translate between UI and model&lt;br /&gt;
&lt;br /&gt;
Managed beans are simple Java objects (POJO's) which are declared in &amp;quot;faces-config.xml&amp;quot; and can be used in an JSF application. For example you can define a Java object &amp;quot;Person&amp;quot;. Once you define the object in faces-config.xml you can use the attributes of Person in your JSF UI components, e.g. by binding the value &amp;quot;firstName&amp;quot; of this object to an JSF input field.&lt;br /&gt;
&lt;br /&gt;
JSF uses the Unified Expression Language (EL) to bind UI components to object attributes or methods.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
This is the model class that returns the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This JSP page is the view for the application and allows the user to get the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;br /&gt;
&lt;br /&gt;
12. [http://www.oracle.com/technetwork/articles/javase/index-142890.html http://www.oracle.com/technetwork/articles/javase/index-142890.html]&lt;br /&gt;
&lt;br /&gt;
13. GuangChun, L., WangYanhua, Xianliang, L, and Hanhong. A Novel Web Application Frame Developed by MVC. Software Engineering Notes. 2003,  &lt;br /&gt;
Vol. 28, 2.&lt;br /&gt;
&lt;br /&gt;
14. Leff, A. and Rayfield, J.T. Web-Application Development Using the Model/View/Controller Design Pattern. IEEE XPlore. 2001.&lt;br /&gt;
&lt;br /&gt;
15. Sauter, P., Vogler, G., Specht, G., and Flor, T. A Model-View-Controller extension for pervasive multi-client user interfaces. Pers Ubiquit Comput. October, 2004.&lt;br /&gt;
&lt;br /&gt;
16. openMVC: A Non-proprietary Component-based Framework for Web Applications. Barrett, R. and Delany, S.J. New York : ACM, WWW 2004.&lt;br /&gt;
&lt;br /&gt;
17. A Database and Web Application Based on MVC Architecture. Selfa, D.M., Carrillo, M., and Rocio Boone, M. Puebla, Mexico : IEEE, IEEE Int. Conf. on Electronics, Communications, and Computers (CONIELECOMP 2006).&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65311</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65311"/>
		<updated>2012-09-20T00:11:41Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to [http://en.wikipedia.org/wiki/Trygve_Reenskaug Trygve Reenskaug], who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model, the view is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==Previous research in MVC==&lt;br /&gt;
&lt;br /&gt;
The MVC framework is a well-established design pattern that is widely used for applications with a user interface component.  Several papers describe applications of the MVC framework for Web application development.  For example, GuangChun et al. (13) describe an approach whereby the model component is a JavaBean, the View is created using Java Server Pages (JSPs), and the Controller is created using a Java servlet.  Leff and Rayfield (14) describe an MVC Web application that provides flexibility in how the application is partitioned between the client and the server.  Sauter et. al (15) describe an MVC application that adapts to multiple client devices, including computers, printers, and handheld devices.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
===[http://rubyonrails.org/ Ruby on Rails]===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model ( [http://api.rubyonrails.org/classes/ActiveRecord/Base.html ActiveRecord] ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( [http://api.rubyonrails.org/classes/ActionView/Base.html ActionView] )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like [http://en.wikipedia.org/wiki/JavaServer_Pages JSP], [http://en.wikipedia.org/wiki/Active_Server_Pages ASP], [http://en.wikipedia.org/wiki/PHP PHP] and very easy to integrate with [http://en.wikipedia.org/wiki/Ajax_(programming) AJAX] technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( [http://api.rubyonrails.org/classes/ActionController/Base.html ActionController] ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
===[http://jakarta.apache.org/struts/index.html Struts framework]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Enterprise_JavaBeans Enterprise JavaBeans], [http://en.wikipedia.org/wiki/Java_Data_Objects Java Data Objects(JDO)] and [http://en.wikipedia.org/wiki/JavaBeans JavaBeans] can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of [http://struts.apache.org/1.x/apidocs/org/apache/struts/action/ActionMapping.html ActionMappings]. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code [http://en.wikipedia.org/wiki/Don't_repeat_yourself DRY]&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Spring_Framework '''Spring framework''']===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
 &lt;br /&gt;
The example is a page displaying a car list.&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
Model classes: Car and Brand&lt;br /&gt;
Manager class: to obtain a list of Cars&lt;br /&gt;
Controller class: will use the list method from the Manager&lt;br /&gt;
View (JSP): display the car list&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
The Brand class serves as a Model class and has the information for id, name and country for the brand.&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The Car class is another Model which has information for the brand, model and price of the car.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The CarManager contains the list of Cars.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
The CarListController will use the list method from the CarManager.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This displays the list of cars along with the brand, model and price.&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/JavaServer_Faces Java Server Faces(JSF)]===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/JavaServer_Faces JSF] is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
A JSF application run in a standard web container, for example Tomcat or Jetty.&lt;br /&gt;
&lt;br /&gt;
A JSF application consists of web pages with JSF UI components. A JSF application requires also some configuration files (&amp;quot;faces-config.xml&amp;quot; and web.xml).&lt;br /&gt;
&lt;br /&gt;
The faces-config.xml defines:&lt;br /&gt;
&lt;br /&gt;
Managed Bean - the data elements of the JSF application (managed beans and backing beans) Represents a Java class which will be created dynamically during runtime of the JSF application. It can be defined for which scope the bean is valid (Session, Request, Application or none).&lt;br /&gt;
&lt;br /&gt;
the navigation between web pages&lt;br /&gt;
&lt;br /&gt;
data validators - Used to check the validity of UI input&lt;br /&gt;
&lt;br /&gt;
data converters -Used to translate between UI and model&lt;br /&gt;
&lt;br /&gt;
Managed beans are simple Java objects (POJO's) which are declared in &amp;quot;faces-config.xml&amp;quot; and can be used in an JSF application. For example you can define a Java object &amp;quot;Person&amp;quot;. Once you define the object in faces-config.xml you can use the attributes of Person in your JSF UI components, e.g. by binding the value &amp;quot;firstName&amp;quot; of this object to an JSF input field.&lt;br /&gt;
&lt;br /&gt;
JSF uses the Unified Expression Language (EL) to bind UI components to object attributes or methods.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
This is the model class that returns the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This JSP page is the view for the application and allows the user to get the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;br /&gt;
&lt;br /&gt;
12. [http://www.oracle.com/technetwork/articles/javase/index-142890.html http://www.oracle.com/technetwork/articles/javase/index-142890.html]&lt;br /&gt;
&lt;br /&gt;
13. GuangChun, L., WangYanhua, Xianliang, L, and Hanhong. A Novel Web Application Frame Developed by MVC. Software Engineering Notes. 2003,  &lt;br /&gt;
Vol. 28, 2.&lt;br /&gt;
&lt;br /&gt;
14. Leff, A. and Rayfield, J.T. Web-Application Development Using the Model/View/Controller Design Pattern. IEEE XPlore. 2001.&lt;br /&gt;
&lt;br /&gt;
15. Sauter, P., Vogler, G., Specht, G., and Flor, T. A Model-View-Controller extension for pervasive multi-client user interfaces. Pers Ubiquit Comput. October, 2004.&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65310</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65310"/>
		<updated>2012-09-20T00:10:57Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to [http://en.wikipedia.org/wiki/Trygve_Reenskaug Trygve Reenskaug], who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model, the view is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==Previous research in MVC==&lt;br /&gt;
&lt;br /&gt;
The MVC framework is a well-established design pattern that is widely used for applications with a user interface component.  Several papers describe applications of the MVC framework for Web application development.  For example, GuangChun et al. (13) describe an approach whereby the model component is a JavaBean, the View is created using Java Server Pages (JSPs), and the Controller is created using a Java servlet.  Leff and Rayfield (14) describe an MVC Web application that provides flexibility in how the application is partitioned between the client and the server.  Sauter et. al (15) describe an MVC application that adapts to multiple client devices, including computers, printers, and handheld devices.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
===[http://rubyonrails.org/ Ruby on Rails]===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model ( [http://api.rubyonrails.org/classes/ActiveRecord/Base.html ActiveRecord] ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( [http://api.rubyonrails.org/classes/ActionView/Base.html ActionView] )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like [http://en.wikipedia.org/wiki/JavaServer_Pages JSP], [http://en.wikipedia.org/wiki/Active_Server_Pages ASP], [http://en.wikipedia.org/wiki/PHP PHP] and very easy to integrate with [http://en.wikipedia.org/wiki/Ajax_(programming) AJAX] technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( [http://api.rubyonrails.org/classes/ActionController/Base.html ActionController] ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
===[http://jakarta.apache.org/struts/index.html Struts framework]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Enterprise_JavaBeans Enterprise JavaBeans], [http://en.wikipedia.org/wiki/Java_Data_Objects Java Data Objects(JDO)] and [http://en.wikipedia.org/wiki/JavaBeans JavaBeans] can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of [http://struts.apache.org/1.x/apidocs/org/apache/struts/action/ActionMapping.html ActionMappings]. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code [http://en.wikipedia.org/wiki/Don't_repeat_yourself DRY]&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Spring_Framework '''Spring framework''']===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
 &lt;br /&gt;
The example is a page displaying a car list.&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
Model classes: Car and Brand&lt;br /&gt;
Manager class: to obtain a list of Cars&lt;br /&gt;
Controller class: will use the list method from the Manager&lt;br /&gt;
View (JSP): display the car list&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
The Brand class serves as a Model class and has the information for id, name and country for the brand.&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The Car class is another Model which has information for the brand, model and price of the car.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The CarManager contains the list of Cars.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
The CarListController will use the list method from the CarManager.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This displays the list of cars along with the brand, model and price.&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/JavaServer_Faces Java Server Faces(JSF)]===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/JavaServer_Faces JSF] is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
A JSF application run in a standard web container, for example Tomcat or Jetty.&lt;br /&gt;
&lt;br /&gt;
A JSF application consists of web pages with JSF UI components. A JSF application requires also some configuration files (&amp;quot;faces-config.xml&amp;quot; and web.xml).&lt;br /&gt;
&lt;br /&gt;
The faces-config.xml defines:&lt;br /&gt;
&lt;br /&gt;
Managed Bean - the data elements of the JSF application (managed beans and backing beans) Represents a Java class which will be created dynamically during runtime of the JSF application. It can be defined for which scope the bean is valid (Session, Request, Application or none).&lt;br /&gt;
&lt;br /&gt;
the navigation between web pages&lt;br /&gt;
&lt;br /&gt;
data validators - Used to check the validity of UI input&lt;br /&gt;
&lt;br /&gt;
data converters -Used to translate between UI and model&lt;br /&gt;
&lt;br /&gt;
Managed beans are simple Java objects (POJO's) which are declared in &amp;quot;faces-config.xml&amp;quot; and can be used in an JSF application. For example you can define a Java object &amp;quot;Person&amp;quot;. Once you define the object in faces-config.xml you can use the attributes of Person in your JSF UI components, e.g. by binding the value &amp;quot;firstName&amp;quot; of this object to an JSF input field.&lt;br /&gt;
&lt;br /&gt;
JSF uses the Unified Expression Language (EL) to bind UI components to object attributes or methods.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
This is the model class that returns the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This JSP page is the view for the application and allows the user to get the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;br /&gt;
&lt;br /&gt;
12. [http://www.oracle.com/technetwork/articles/javase/index-142890.html http://www.oracle.com/technetwork/articles/javase/index-142890.html]&lt;br /&gt;
&lt;br /&gt;
13. GuangChun, L., WangYanhua, Xianliang, L, and Hanhong. A Novel Web Application Frame Developed by MVC. Software Engineering Notes. 2003,  &lt;br /&gt;
    Vol. 28, 2.&lt;br /&gt;
&lt;br /&gt;
14. Leff, A. and Rayfield, J.T. Web-Application Development Using the Model/View/Controller Design Pattern. IEEE XPlore. 2001.&lt;br /&gt;
&lt;br /&gt;
15. Sauter, P., Vogler, G., Specht, G., and Flor, T. A Model-View-Controller extension for pervasive multi-client user interfaces. Pers &lt;br /&gt;
    Ubiquit Comput. October, 2004.&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65307</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65307"/>
		<updated>2012-09-19T23:56:28Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to [http://en.wikipedia.org/wiki/Trygve_Reenskaug Trygve Reenskaug], who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model, the view is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
===[http://rubyonrails.org/ Ruby on Rails]===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model ( [http://api.rubyonrails.org/classes/ActiveRecord/Base.html ActiveRecord] ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( [http://api.rubyonrails.org/classes/ActionView/Base.html ActionView] )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like [http://en.wikipedia.org/wiki/JavaServer_Pages JSP], [http://en.wikipedia.org/wiki/Active_Server_Pages ASP], [http://en.wikipedia.org/wiki/PHP PHP] and very easy to integrate with [http://en.wikipedia.org/wiki/Ajax_(programming) AJAX] technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( [http://api.rubyonrails.org/classes/ActionController/Base.html ActionController] ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
===[http://jakarta.apache.org/struts/index.html Struts framework]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Enterprise_JavaBeans Enterprise JavaBeans], [http://en.wikipedia.org/wiki/Java_Data_Objects Java Data Objects(JDO)] and [http://en.wikipedia.org/wiki/JavaBeans JavaBeans] can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of [http://struts.apache.org/1.x/apidocs/org/apache/struts/action/ActionMapping.html ActionMappings]. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code [http://en.wikipedia.org/wiki/Don't_repeat_yourself DRY]&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Spring_Framework '''Spring framework''']===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
 &lt;br /&gt;
The example is a page displaying a car list.&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
Model classes: Car and Brand&lt;br /&gt;
Manager class: to obtain a list of Cars&lt;br /&gt;
Controller class: will use the list method from the Manager&lt;br /&gt;
View (JSP): display the car list&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
The Brand class serves as a Model class and has the information for id, name and country for the brand.&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The Car class is another Model which has information for the brand, model and price of the car.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The CarManager contains the list of Cars.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
The CarListController will use the list method from the CarManager.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This displays the list of cars along with the brand, model and price.&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/JavaServer_Faces Java Server Faces(JSF)]===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/JavaServer_Faces JSF] is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
A JSF application run in a standard web container, for example Tomcat or Jetty.&lt;br /&gt;
&lt;br /&gt;
A JSF application consists of web pages with JSF UI components. A JSF application requires also some configuration files (&amp;quot;faces-config.xml&amp;quot; and web.xml).&lt;br /&gt;
&lt;br /&gt;
The faces-config.xml defines:&lt;br /&gt;
&lt;br /&gt;
Managed Bean - the data elements of the JSF application (managed beans and backing beans) Represents a Java class which will be created dynamically during runtime of the JSF application. It can be defined for which scope the bean is valid (Session, Request, Application or none).&lt;br /&gt;
&lt;br /&gt;
the navigation between web pages&lt;br /&gt;
&lt;br /&gt;
data validators - Used to check the validity of UI input&lt;br /&gt;
&lt;br /&gt;
data converters -Used to translate between UI and model&lt;br /&gt;
&lt;br /&gt;
Managed beans are simple Java objects (POJO's) which are declared in &amp;quot;faces-config.xml&amp;quot; and can be used in an JSF application. For example you can define a Java object &amp;quot;Person&amp;quot;. Once you define the object in faces-config.xml you can use the attributes of Person in your JSF UI components, e.g. by binding the value &amp;quot;firstName&amp;quot; of this object to an JSF input field.&lt;br /&gt;
&lt;br /&gt;
JSF uses the Unified Expression Language (EL) to bind UI components to object attributes or methods.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
This is the model class that returns the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This JSP page is the view for the application and allows the user to get the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;br /&gt;
&lt;br /&gt;
12. [http://www.oracle.com/technetwork/articles/javase/index-142890.html http://www.oracle.com/technetwork/articles/javase/index-142890.html]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65293</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65293"/>
		<updated>2012-09-19T23:41:45Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to [http://en.wikipedia.org/wiki/Trygve_Reenskaug Trygve Reenskaug], who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model, the view is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
===[http://rubyonrails.org/ Ruby on Rails]===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like [http://en.wikipedia.org/wiki/JavaServer_Pages JSP], [http://en.wikipedia.org/wiki/Active_Server_Pages ASP], [http://en.wikipedia.org/wiki/PHP PHP] and very easy to integrate with [http://en.wikipedia.org/wiki/Ajax_(programming) AJAX] technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
===[http://jakarta.apache.org/struts/index.html Struts framework]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Enterprise_JavaBeans Enterprise JavaBeans], [http://en.wikipedia.org/wiki/Java_Data_Objects Java Data Objects(JDO)] and [http://en.wikipedia.org/wiki/JavaBeans JavaBeans] can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code [http://en.wikipedia.org/wiki/Don't_repeat_yourself DRY]&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Spring_Framework '''Spring framework''']===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
 &lt;br /&gt;
The example is a page displaying a car list.&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
Model classes: Car and Brand&lt;br /&gt;
Manager class: to obtain a list of Cars&lt;br /&gt;
Controller class: will use the list method from the Manager&lt;br /&gt;
View (JSP): display the car list&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
The Brand class serves as a Model class and has the information for id, name and country for the brand.&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The Car class is another Model which has information for the brand, model and price of the car.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The CarManager contains the list of Cars.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
The CarListController will use the list method from the CarManager.&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This displays the list of cars along with the brand, model and price.&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/JavaServer_Faces Java Server Faces(JSF)]===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/JavaServer_Faces JSF] is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
A JSF application run in a standard web container, for example Tomcat or Jetty.&lt;br /&gt;
&lt;br /&gt;
A JSF application consists of web pages with JSF UI components. A JSF application requires also some configuration files (&amp;quot;faces-config.xml&amp;quot; and web.xml).&lt;br /&gt;
&lt;br /&gt;
The faces-config.xml defines:&lt;br /&gt;
&lt;br /&gt;
Managed Bean - the data elements of the JSF application (managed beans and backing beans) Represents a Java class which will be created dynamically during runtime of the JSF application. It can be defined for which scope the bean is valid (Session, Request, Application or none).&lt;br /&gt;
&lt;br /&gt;
the navigation between web pages&lt;br /&gt;
&lt;br /&gt;
data validators - Used to check the validity of UI input&lt;br /&gt;
&lt;br /&gt;
data converters -Used to translate between UI and model&lt;br /&gt;
&lt;br /&gt;
Managed beans are simple Java objects (POJO's) which are declared in &amp;quot;faces-config.xml&amp;quot; and can be used in an JSF application. For example you can define a Java object &amp;quot;Person&amp;quot;. Once you define the object in faces-config.xml you can use the attributes of Person in your JSF UI components, e.g. by binding the value &amp;quot;firstName&amp;quot; of this object to an JSF input field.&lt;br /&gt;
&lt;br /&gt;
JSF uses the Unified Expression Language (EL) to bind UI components to object attributes or methods.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
This is the model class that returns the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
This JSP page is the view for the application and allows the user to get the celsius or fahrenheit temperature.&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;br /&gt;
&lt;br /&gt;
12. [http://www.oracle.com/technetwork/articles/javase/index-142890.html http://www.oracle.com/technetwork/articles/javase/index-142890.html]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65281</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65281"/>
		<updated>2012-09-19T23:26:45Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller MVC] pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to [http://en.wikipedia.org/wiki/Trygve_Reenskaug Trygve Reenskaug], who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model, the view is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
===[http://rubyonrails.org/ Ruby on Rails]===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like [http://en.wikipedia.org/wiki/JavaServer_Pages JSP], [http://en.wikipedia.org/wiki/Active_Server_Pages ASP], [http://en.wikipedia.org/wiki/PHP PHP] and very easy to integrate with [http://en.wikipedia.org/wiki/Ajax_(programming) AJAX] technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
===[http://jakarta.apache.org/struts/index.html Struts framework]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Enterprise_JavaBeans Enterprise JavaBeans], [http://en.wikipedia.org/wiki/Java_Data_Objects Java Data Objects(JDO)] and [http://en.wikipedia.org/wiki/JavaBeans JavaBeans] can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code [http://en.wikipedia.org/wiki/Don't_repeat_yourself DRY]&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Spring_Framework '''Spring framework''']===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;br /&gt;
&lt;br /&gt;
12. [http://www.oracle.com/technetwork/articles/javase/index-142890.html http://www.oracle.com/technetwork/articles/javase/index-142890.html]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65166</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65166"/>
		<updated>2012-09-15T06:00:08Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Java Server Faces(JSF) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
=== Struts ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
*'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
*'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65165</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65165"/>
		<updated>2012-09-15T05:58:09Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* MVC pattern in web application development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
 1. The controller loads/modifies model objects&lt;br /&gt;
 2. It then passes the model to a view&lt;br /&gt;
 3. Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
=== Struts ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65164</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65164"/>
		<updated>2012-09-15T05:55:30Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80's saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
=== Struts ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65163</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65163"/>
		<updated>2012-09-15T05:55:00Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
=== Struts ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65162</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65162"/>
		<updated>2012-09-15T05:54:47Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state.&lt;br /&gt;
&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
=== Struts ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65161</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65161"/>
		<updated>2012-09-15T05:53:31Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
=== Struts ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework Web Application Frameworks]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller(MVC)]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ Ruby on Rails]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html MVC: &amp;quot;Introduction and History&amp;quot; ]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html Struts framework]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ Spring framework]&lt;br /&gt;
&lt;br /&gt;
11. [http://www.javaserverfaces.org/ Java Server Faces(JSF)]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65160</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65160"/>
		<updated>2012-09-15T05:50:27Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Struts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
=== Struts ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ http://www.springsource.org/]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65159</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65159"/>
		<updated>2012-09-15T05:50:15Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Ruby on Rails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
=== Ruby on Rails ===&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ http://www.springsource.org/]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65158</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65158"/>
		<updated>2012-09-15T05:49:44Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java Server Faces(JSF)===&lt;br /&gt;
&lt;br /&gt;
JavaServer Faces (JSF) is a UI component based Java Web application framework. JSF is serverbased, e.g. the JSF UI components and their state are represented on the server with a defined life-cycle of the UI components. JSF is part of the Java EE standard.&lt;br /&gt;
&lt;br /&gt;
JSF is based on the following configuration files:&lt;br /&gt;
&lt;br /&gt;
'''web.xml - General web application configuration file'''&lt;br /&gt;
&lt;br /&gt;
You must specify in web.xml that a &amp;quot;FacesServlet&amp;quot; is responsible for handling JSF applications. &amp;quot;FacesServlet&amp;quot; is the central controller for the JSF application. &amp;quot;FacesServlet&amp;quot; receives all requests for the JSF application and initializes the JSF components before the JSP is displayed.&lt;br /&gt;
&lt;br /&gt;
'''faces-config.xml - Contains the configuration of the JSF application.'''&lt;br /&gt;
&lt;br /&gt;
&amp;quot;faces-config.xml&amp;quot; allows to configure the application, managed beans, convertors, validators, and navigation.&lt;br /&gt;
&lt;br /&gt;
* '''Model'''&lt;br /&gt;
&lt;br /&gt;
 package jsf.first.model;&lt;br /&gt;
 public class TemperatureConvertor {&lt;br /&gt;
  private double celsius; &lt;br /&gt;
  private double fahrenheit;&lt;br /&gt;
  private boolean initial= true; &lt;br /&gt;
  &lt;br /&gt;
 public double getCelsius() {&lt;br /&gt;
  return celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public void setCelsius(double celsius) {&lt;br /&gt;
  this.celsius = celsius;&lt;br /&gt;
  }&lt;br /&gt;
 public double getFahrenheit() {&lt;br /&gt;
  return fahrenheit;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public boolean getInitial(){&lt;br /&gt;
  return initial;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
 public String reset (){&lt;br /&gt;
  initial = true;&lt;br /&gt;
   fahrenheit =0;&lt;br /&gt;
   celsius = 0; &lt;br /&gt;
   return &amp;quot;reset&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public String celsiusToFahrenheit(){&lt;br /&gt;
  initial = false; &lt;br /&gt;
  fahrenheit = (celsius *9 / 5) +32;&lt;br /&gt;
  return &amp;quot;calculated&amp;quot;;&lt;br /&gt;
 } &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''Convertor.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ page language=&amp;quot;java&amp;quot; contentType=&amp;quot;text/html; charset=ISO-8859-1&amp;quot; pageEncoding=&amp;quot;ISO-8859-1&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;f&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/core&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;h&amp;quot;  uri=&amp;quot;http://java.sun.com/jsf/html&amp;quot;%&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/html4/loose.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
 &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=ISO-8859-1&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;title&amp;gt;Celsius to Fahrenheit Convertor&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
 &amp;lt;f:view&amp;gt;&lt;br /&gt;
  &amp;lt;h:form&amp;gt;&lt;br /&gt;
   &amp;lt;h:panelGrid columns=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h:outputLabel value=&amp;quot;Celsius&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
    &amp;lt;h:inputText  value=&amp;quot;#{temperatureConvertor.celsius}&amp;quot;&amp;gt;&amp;lt;/h:inputText&amp;gt;&lt;br /&gt;
   &amp;lt;/h:panelGrid&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.celsiusToFahrenheit}&amp;quot; value=&amp;quot;Calculate&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:commandButton action=&amp;quot;#{temperatureConvertor.reset}&amp;quot; value=&amp;quot;Reset&amp;quot;&amp;gt;&amp;lt;/h:commandButton&amp;gt;&lt;br /&gt;
    &amp;lt;h:messages layout=&amp;quot;table&amp;quot;&amp;gt;&amp;lt;/h:messages&amp;gt;&lt;br /&gt;
  &amp;lt;/h:form&amp;gt;&lt;br /&gt;
  &amp;lt;h:panelGroup rendered=&amp;quot;#{temperatureConvertor.initial!=true}&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;Fahrenheit &amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;h:outputLabel value=&amp;quot;#{temperatureConvertor.fahrenheit}&amp;quot;&amp;gt;&amp;lt;/h:outputLabel&amp;gt;&lt;br /&gt;
  &amp;lt;/h:panelGroup&amp;gt;&lt;br /&gt;
 &amp;lt;/f:view&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ http://www.springsource.org/]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65157</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65157"/>
		<updated>2012-09-15T05:21:41Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Disadvantages of MVC pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ http://www.springsource.org/]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65156</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65156"/>
		<updated>2012-09-15T05:16:42Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* It MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be   flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;br /&gt;
&lt;br /&gt;
9. [http://en.wikipedia.org/wiki/Spring_Framework http://en.wikipedia.org/wiki/Spring_Framework]&lt;br /&gt;
&lt;br /&gt;
10. [http://www.springsource.org/ http://www.springsource.org/]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65155</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65155"/>
		<updated>2012-09-15T05:15:38Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Spring framework */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* It MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be   flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
The Spring Framework is an open source application framework and Inversion of Control container for the Java platform.&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65154</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65154"/>
		<updated>2012-09-15T05:09:09Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* It MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be   flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''Controller'''&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* '''View'''&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65153</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65153"/>
		<updated>2012-09-15T05:06:58Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* It MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be   flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
==='''Spring framework'''===&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.model;&lt;br /&gt;
  public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.model;&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/service/CarManager.java'''&lt;br /&gt;
&lt;br /&gt;
  package springmvc.service;&lt;br /&gt;
 &lt;br /&gt;
  import java.math.BigDecimal;&lt;br /&gt;
  import java.util.LinkedList;&lt;br /&gt;
  import java.util.List;&lt;br /&gt;
  import springmvc.model.Brand;&lt;br /&gt;
  import springmvc.model.Car;&lt;br /&gt;
 &lt;br /&gt;
 public class CarManager {&lt;br /&gt;
 &lt;br /&gt;
  private static List&amp;lt;Car&amp;gt; carList;&lt;br /&gt;
 &lt;br /&gt;
   static {&lt;br /&gt;
    Brand brand1 = new Brand();&lt;br /&gt;
    brand1.setId((long)1);&lt;br /&gt;
    brand1.setName(&amp;quot;Mercedes&amp;quot;);&lt;br /&gt;
    brand1.setCountry(&amp;quot;Germany&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Brand brand2 = new Brand();&lt;br /&gt;
    brand2.setId((long)2);&lt;br /&gt;
    brand2.setName(&amp;quot;Peugeot&amp;quot;);&lt;br /&gt;
    brand2.setCountry(&amp;quot;France&amp;quot;);		&lt;br /&gt;
 &lt;br /&gt;
    Car car1 = new Car();&lt;br /&gt;
    car1.setId((long)1);&lt;br /&gt;
    car1.setBrand(brand1);&lt;br /&gt;
    car1.setModel(&amp;quot;SL 500&amp;quot;);&lt;br /&gt;
    car1.setPrice(new BigDecimal(40000));&lt;br /&gt;
 &lt;br /&gt;
    Car car2 = new Car();&lt;br /&gt;
    car2.setId((long)2); &lt;br /&gt;
    car2.setBrand(brand2);&lt;br /&gt;
    car2.setModel(&amp;quot;607&amp;quot;);&lt;br /&gt;
    car2.setPrice(new BigDecimal(35000));&lt;br /&gt;
 &lt;br /&gt;
    carList = new LinkedList&amp;lt;Car&amp;gt;();&lt;br /&gt;
    carList.add(car1);&lt;br /&gt;
    carList.add(car2);		&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public List&amp;lt;Car&amp;gt; getCarList() {&lt;br /&gt;
     return carList;&lt;br /&gt;
    }	&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''In 'WEB-INF/springmvc-servlet.xml', we declare a new URL:'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;bean name=&amp;quot;/list_cars.html&amp;quot; class=&amp;quot;springmvc.web.CarListController&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Controller==&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/web/CarListController.java'''&lt;br /&gt;
&lt;br /&gt;
 package springmvc.web;&lt;br /&gt;
 &lt;br /&gt;
 import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
 import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
 &lt;br /&gt;
 import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
 import org.springframework.web.servlet.mvc.Controller;&lt;br /&gt;
 &lt;br /&gt;
 import springmvc.service.CarManager;&lt;br /&gt;
 &lt;br /&gt;
 public class CarListController implements Controller {&lt;br /&gt;
 &lt;br /&gt;
  public ModelAndView handleRequest(HttpServletRequest arg0,&lt;br /&gt;
   HttpServletResponse arg1) throws Exception {&lt;br /&gt;
 &lt;br /&gt;
  CarManager carManager = new CarManager();&lt;br /&gt;
 &lt;br /&gt;
  ModelAndView modelAndView = new ModelAndView(&amp;quot;carList&amp;quot;);&lt;br /&gt;
  modelAndView.addObject(&amp;quot;carList&amp;quot;, carManager.getCarList());&lt;br /&gt;
 &lt;br /&gt;
  return modelAndView;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==View==&lt;br /&gt;
&lt;br /&gt;
'''jsp/carList.jsp'''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;%@ taglib prefix=&amp;quot;c&amp;quot; uri=&amp;quot;http://java.sun.com/jsp/jstl/core&amp;quot; %&amp;gt;&lt;br /&gt;
 &amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;c:forEach items=&amp;quot;${carList}&amp;quot; var=&amp;quot;car&amp;quot;&amp;gt;&lt;br /&gt;
     ${car.brand.name} ${car.model}: ${car.price}&lt;br /&gt;
    &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;
  &amp;lt;/body&amp;gt;&lt;br /&gt;
 &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65114</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65114"/>
		<updated>2012-09-15T02:38:05Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* It MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be   flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
'''Spring framework'''&lt;br /&gt;
&lt;br /&gt;
[[File:Spring-mv.jpg]]&lt;br /&gt;
&lt;br /&gt;
* '''Model classes'''&lt;br /&gt;
&lt;br /&gt;
'''‎WEB-INF/src/springmvc/model/Brand.java'''&lt;br /&gt;
&lt;br /&gt;
 public class Brand {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private String name;&lt;br /&gt;
  private String country;&lt;br /&gt;
 &lt;br /&gt;
  public String getCountry() {&lt;br /&gt;
   return country;&lt;br /&gt;
  }&lt;br /&gt;
  public void setCountry(String country) {&lt;br /&gt;
   this.country = country;&lt;br /&gt;
  }&lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getName() {&lt;br /&gt;
   return name;&lt;br /&gt;
  }&lt;br /&gt;
  public void setName(String name) {&lt;br /&gt;
   this.name = name;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''WEB-INF/src/springmvc/model/Car.java'''&lt;br /&gt;
&lt;br /&gt;
 import java.math.BigDecimal;&lt;br /&gt;
 &lt;br /&gt;
 public class Car {&lt;br /&gt;
  private Long id;&lt;br /&gt;
  private Brand brand;&lt;br /&gt;
  private String model;&lt;br /&gt;
  private BigDecimal price;&lt;br /&gt;
 &lt;br /&gt;
  public Long getId() {&lt;br /&gt;
   return id;&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(Long id) {&lt;br /&gt;
   this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public Brand getBrand() {&lt;br /&gt;
   return brand;&lt;br /&gt;
  }&lt;br /&gt;
  public void setBrand(Brand brand) {&lt;br /&gt;
   this.brand = brand;&lt;br /&gt;
  }&lt;br /&gt;
  public String getModel() {&lt;br /&gt;
   return model;&lt;br /&gt;
  }&lt;br /&gt;
  public void setModel(String model) {&lt;br /&gt;
   this.model = model;&lt;br /&gt;
  }&lt;br /&gt;
  public BigDecimal getPrice() {&lt;br /&gt;
   return price;&lt;br /&gt;
  }&lt;br /&gt;
  public void setPrice(BigDecimal price) {&lt;br /&gt;
   this.price = price;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Spring-mv.jpg&amp;diff=65108</id>
		<title>File:Spring-mv.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Spring-mv.jpg&amp;diff=65108"/>
		<updated>2012-09-15T02:24:55Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65074</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=65074"/>
		<updated>2012-09-15T01:58:06Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
  * '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds &lt;br /&gt;
    to instructions from the controller to change state.&lt;br /&gt;
  * '''View''': The view refers to the user interface and manages the display of information&lt;br /&gt;
  * '''Controller''': The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
[[File:Mvc-structure-generic.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a classic MVC model the View is supposed to learn by observing the relevant model as the View and Controller are transparent to each other. The view updates itself through observing the relevant model. Therefore the model needs to implement the observer pattern. Controller handles the user inputs and delegates the user actions to method calls in the models.                                                                      &lt;br /&gt;
&lt;br /&gt;
A complete screen can be understood as a collection of widgets - each widget element consisting of its own View and Controller object.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI  are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again.&lt;br /&gt;
The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a &amp;quot;main menu&amp;quot;, a &amp;quot;news list&amp;quot;, a &amp;quot;basket&amp;quot; etc. The web server always needs to generate the complete view with all its subviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:mvc-web.jpg]]  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A MVC Framework for web applications therefore normally works this way:&lt;br /&gt;
*The request that is sent from the browser to the web server goes to a front controller, which then builds a request object and starts processing the request.&lt;br /&gt;
*This is followed by “dispatching” .The Controller objects call the action methods that belong to the current request and are responsible to return the correct response. This can be roughly summarized as:&lt;br /&gt;
  *The controller loads/modifies model objects&lt;br /&gt;
  *It then passes the model to a view&lt;br /&gt;
  *Next it calls the view &amp;quot;render()&amp;quot; method to get the response.&lt;br /&gt;
*Normally the view that is returned to the browser consist of a hierarchy of subviews and/or widgets&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available.&lt;br /&gt;
Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few.&lt;br /&gt;
&lt;br /&gt;
== Ruby on Rails ==&lt;br /&gt;
Ruby on Rails is an open source full-stack web application framework for the Ruby programming language.&lt;br /&gt;
&lt;br /&gt;
'''Model (ActiveRecord ) :'''&lt;br /&gt;
Maintains the relationship between Object and Database and handles validation, association, transactions, and more.&lt;br /&gt;
This subsystem is implemented in ActiveRecord library which provides an interface and binding between the tables in a relational database and the Ruby program code that manipulates database records. Ruby method names are automatically generated from the field names of database tables, and so on.&lt;br /&gt;
&lt;br /&gt;
'''View ( ActionView )'''&lt;br /&gt;
A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.&lt;br /&gt;
This subsystem is implemented in ActionView library which is an Embedded Ruby (ERb) based system for defining presentation templates for data presentation. Every Web connection to a Rails application results in the displaying of a view.&lt;br /&gt;
&lt;br /&gt;
'''Controller ( ActionController ):'''&lt;br /&gt;
The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data into a form that fits the needs of a given view.&lt;br /&gt;
This subsystem is implemented in ActionController which is a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).&lt;br /&gt;
&lt;br /&gt;
== Struts ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struts is a set of Java classes and JSP tag libraries that uses a model-view-controller (MVC) design pattern to provide a framework for developing Web applications. Struts is an open source subproject of the Apache Software Foundation's Jakarta project.&lt;br /&gt;
&lt;br /&gt;
'''Model:'''&lt;br /&gt;
The Enterprise JavaBeans (EJB), Java Data Objects(JDO) and JavaBeans can be use as a model. Struts frame work doesn't limit you to one particular model implementation.&lt;br /&gt;
&lt;br /&gt;
'''View:'''&lt;br /&gt;
The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionFormbeans. ActionForms capture and validate whatever input is required by the application.&lt;br /&gt;
&lt;br /&gt;
'''Controller:'''&lt;br /&gt;
The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
* It MVC pattern introduces new levels of indirection and therefore increases the complexity of the solution. &lt;br /&gt;
* It also increases the event-driven nature of the user-interface code, which can become more difficult to debug.&lt;br /&gt;
* Developers cannot completely ignore the view of the model even if they are decoupled. If the model undergoes frequent changes, the views could be   flooded with update requests.Views like graphical displays may take some time to render. As a result, the view may fall behind update requests as frequent updates may increase the cost significantly.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;br /&gt;
&lt;br /&gt;
7. [http://www.careerride.com/MVC-disadvantages.aspx http://www.careerride.com/MVC-disadvantages.aspx]&lt;br /&gt;
&lt;br /&gt;
8. [http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Ruby_on_Rails ]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=64511</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w20 pp</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w20_pp&amp;diff=64511"/>
		<updated>2012-09-14T21:57:56Z</updated>

		<summary type="html">&lt;p&gt;Pmpereir: /* Disadvantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding.  This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.&lt;br /&gt;
&lt;br /&gt;
The '''Model-View-Controller (MVC)''' pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:&lt;br /&gt;
&lt;br /&gt;
* '''Model''': The model manages the behavior and data of the application domain. It responds to requests for the user interface(view), and responds to instructions from the controller to change state.&lt;br /&gt;
&lt;br /&gt;
* '''View:''' The view refers to the user interface and manages the display of information&lt;br /&gt;
&lt;br /&gt;
* '''Controller:''' The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.&lt;br /&gt;
&lt;br /&gt;
==MVC pattern in web application development==&lt;br /&gt;
&lt;br /&gt;
==Web frameworks using MVC pattern==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of MVC pattern==&lt;br /&gt;
==='''Advantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* You can distribute development effort to some extent, so that implementation changes in one part of the Web application do not require changes to another. The developers responsible for writing the business logic can work independently of the developers responsible for the flow of control, and Web-page designers can work independently of the developers.&lt;br /&gt;
* You can more easily migrate legacy programs, because the view is separate from the model and the control and can be tailored to platform and user category.&lt;br /&gt;
* Isolation of business logic from the user interface&lt;br /&gt;
* Ease of keeping code DRY&lt;br /&gt;
* Making it clear where different types of code belong for easier maintenance&lt;br /&gt;
* Since MVC separates the application into the model, view and controller components, it increases the maintainability of the application&lt;br /&gt;
* Testing is easier since the components are independent.&lt;br /&gt;
* Multiple views can reuse the same model objects, thus facilitating code reusability.&lt;br /&gt;
* MVC architecture helps in developing loosely coupled systems&lt;br /&gt;
* The modularity of MVC enables easier changes to the user interface.&lt;br /&gt;
&lt;br /&gt;
==='''Disadvantages of MVC pattern'''===&lt;br /&gt;
&lt;br /&gt;
* Using MVC initially can feel a bit restrictive.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
1. [http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html  http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html]&lt;br /&gt;
&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/Web_application_framework http://en.wikipedia.org/wiki/Web_application_framework]&lt;br /&gt;
&lt;br /&gt;
3. [http://en.wikipedia.org/wiki/Model-view-controller http://en.wikipedia.org/wiki/Model-view-controller]&lt;br /&gt;
&lt;br /&gt;
4. [http://rubyonrails.org/ http://rubyonrails.org/]&lt;br /&gt;
&lt;br /&gt;
5. [http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html]&lt;br /&gt;
&lt;br /&gt;
6. [http://jakarta.apache.org/struts/index.html http://jakarta.apache.org/struts/index.html]&lt;/div&gt;</summary>
		<author><name>Pmpereir</name></author>
	</entry>
</feed>