<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3262343092973867172</id><updated>2024-08-29T20:56:38.331-07:00</updated><title type='text'>JAVA J2EE</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vinuj2ee.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://vinuj2ee.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3262343092973867172.post-6757657372590062302</id><published>2011-04-21T08:02:00.000-07:00</published><updated>2011-04-22T19:09:59.432-07:00</updated><title type='text'>MVC with configurable controller</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;You must be wondering what went wrong with MVC. When application gets&amp;nbsp;large you cannot stick to bare bone MVC. You have to extend it somehow to deal&amp;nbsp;with these complexities. One mechanism of extending MVC that has found&amp;nbsp;widespread adoption is based on a configurable controller Servlet. The MVC&amp;nbsp;with configurable controller servlet.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;When the HTTP request arrives from the client, the Controller Servlet looks&amp;nbsp;up in a properties file to decide on the right Handler class for the HTTP request.This Handler class is referred to as the Request Handler. The Request Handler &amp;nbsp;contains the presentation logic for that HTTP request including business logic&amp;nbsp;invocation. In other words, the Request Handler does everything that is needed to&amp;nbsp;handle the HTTP request. The only difference so far from the bare bone MVC is&amp;nbsp;that the controller servlet looks up in a properties file to instantiate the Handler&amp;nbsp;instead of calling it directly.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif99KreToKX8YYshIdHBK7Tq0TCV6qj1S3ixVL909uV3L-5gPNPgQnj97f-8VmjjBOvJ4iNGhQI51QZluAIuACdqzP0tHoe0UjBbHbrpE-lvSbw5ZB76RVYKHM1hyphenhyphenBnIupa9SPppdTjck/s1600/untitled+%25281%2529.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif99KreToKX8YYshIdHBK7Tq0TCV6qj1S3ixVL909uV3L-5gPNPgQnj97f-8VmjjBOvJ4iNGhQI51QZluAIuACdqzP0tHoe0UjBbHbrpE-lvSbw5ZB76RVYKHM1hyphenhyphenBnIupa9SPppdTjck/s400/untitled+%25281%2529.gif&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinuj2ee.blogspot.com/feeds/6757657372590062302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/mvc-with-configurable-controller.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/6757657372590062302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/6757657372590062302'/><link rel='alternate' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/mvc-with-configurable-controller.html' title='MVC with configurable controller'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif99KreToKX8YYshIdHBK7Tq0TCV6qj1S3ixVL909uV3L-5gPNPgQnj97f-8VmjjBOvJ4iNGhQI51QZluAIuACdqzP0tHoe0UjBbHbrpE-lvSbw5ZB76RVYKHM1hyphenhyphenBnIupa9SPppdTjck/s72-c/untitled+%25281%2529.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3262343092973867172.post-8542187125587222593</id><published>2011-04-21T07:55:00.000-07:00</published><updated>2011-04-21T07:55:39.291-07:00</updated><title type='text'>Model 2 Architecture - MVC</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;The Model 2 architecture for designing JSP pages is in reality, Model View&amp;nbsp;Controller (MVC) applied to web applications. Hence the two terms can be used&amp;nbsp;interchangeably in the web world. MVC originated in SmallTalk and has since&amp;nbsp;made its way into Java community. Model 2 architecure and its derivatives are&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;the cornerstones for all serious and industrial strength web applications designed&amp;nbsp;in the real world. Hence it is essential for you understand this paradigm&amp;nbsp;thoroughly.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;The main difference between Model 1 and Model 2 is that in Model 2, a&amp;nbsp;controller handles the user request instead of another JSP. The controller is&amp;nbsp;implemented as a Servlet. The following steps are executed when the user&amp;nbsp;submits the request.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. The Controller Servlet handles the user’s request. (This means the hyperlink&amp;nbsp;in the JSP should point to the controller servlet).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. The Controller Servlet then instantiates appropriate JavaBeans based on the&amp;nbsp;request parameters (and optionally also based on session attributes).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. The Controller Servlet then by itself or through a controller helper&amp;nbsp;communicates with the middle tier or directly to the database to fetch the&amp;nbsp;required data.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;4. The Controller sets the resultant JavaBeans (either same or a new one) in one&amp;nbsp;of the following contexts – request, session or application.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. The controller then dispatches the request to the next view based on the&amp;nbsp;request URL.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. The View uses the resultant JavaBeans from Step 4 to display data.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Note that there is no presentation logic in the JSP. The sole function of the&amp;nbsp;JSP in Model 2 architecture is to display the data from the JavaBeans set in the&amp;nbsp;request, session or application scopes.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzAvWaiKBa0fKMbO2q1bsxxbD2DH7y1FdhvHLlWJxEQH_UgueidGPd9BIEvszm0w6PxBQC9fcitdsvctPRoFFPnUOjlckV8zGBW2jUe4PqAc64pWveZx-WAnkkMgoKzJ1ZxNj7JoOgSvY/s1600/untitled.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzAvWaiKBa0fKMbO2q1bsxxbD2DH7y1FdhvHLlWJxEQH_UgueidGPd9BIEvszm0w6PxBQC9fcitdsvctPRoFFPnUOjlckV8zGBW2jUe4PqAc64pWveZx-WAnkkMgoKzJ1ZxNj7JoOgSvY/s320/untitled.gif&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Advantages of Model 2 Architecture&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Since there is no presentation logic in JSP, there are no scriptlets. This means&amp;nbsp;lesser nightmares. [Note that although Model 2 is directed towards elimination ofscriptlets, it does not architecturally prevent you from adding scriptlets. This has&amp;nbsp;led to widespread misuse of Model 2 architecture.With MVC you can have as many controller servlets in your web application.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;In fact you can have one Controller Servlet per module. However there are&amp;nbsp;several advantages of having a single controller servlet for the entire web&amp;nbsp;application. In a typical web application, there are several tasks that you want todo for every incoming request. For instance, you have to check if the user&amp;nbsp;requesting an operation is authorized to do so. You also want to log the user’s&amp;nbsp;entry and exit from the web application for every request. You might like to&amp;nbsp;centralize the logic for dispatching requests to other views. The list goes on. If&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;you have several controller servlets, chances are that you have to duplicate the&amp;nbsp;logic for all the above tasks in all those places. A single controller servlet for the&amp;nbsp;web application lets you centralize all the tasks in a single place. Elegant code&amp;nbsp;and easier to maintain.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Web applications based on Model 2 architecture are easier to maintain and&amp;nbsp;extend since the views do not refer to each other and there is no presentation&amp;nbsp;logic in the views. It also allows you to clearly define the roles and&amp;nbsp;responsibilities in large projects thus allowing better coordination among team&amp;nbsp;members.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Controller gone bad – Fat Controller&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;If MVC is all that great, why do we need Struts after all? The answer lies inthe difficulties associated in applying bare bone MVC to real world complexities. &amp;nbsp;In medium to large applications, centralized control and processing logic in the&amp;nbsp;servlet – the greatest plus of MVC is also its weakness. Consider a mediocre&amp;nbsp;application with 15 JSPs. Assume that each page has five hyperlinks (or five&amp;nbsp;form submissions). The total number of user requests to be handled in the&amp;nbsp;application is 75. Since we are using MVC framework, a centralized controller&amp;nbsp;servlet handles every user request. For each type of incoming request there is “if”&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;block in the doGet method of the controller Servlet to process the request and&amp;nbsp;dispatch to the next view. For this mediocre application of ours, the controller&amp;nbsp;Servlet has 75 if blocks. Even if you assume that each if block delegates the&amp;nbsp;request handling to helper classes it is still no good. You can only imagine how&amp;nbsp;bad it gets for a complex enterprise web application. So, we have a problem at&amp;nbsp;hand. The Controller Servlet that started out as the greatest thing next to sliced&amp;nbsp;bread has gone bad. It has put on a lot of weight to become a Fat Controller.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinuj2ee.blogspot.com/feeds/8542187125587222593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/model-2-architecture-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/8542187125587222593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/8542187125587222593'/><link rel='alternate' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/model-2-architecture-mvc.html' title='Model 2 Architecture - MVC'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzAvWaiKBa0fKMbO2q1bsxxbD2DH7y1FdhvHLlWJxEQH_UgueidGPd9BIEvszm0w6PxBQC9fcitdsvctPRoFFPnUOjlckV8zGBW2jUe4PqAc64pWveZx-WAnkkMgoKzJ1ZxNj7JoOgSvY/s72-c/untitled.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3262343092973867172.post-7294908854186961049</id><published>2011-04-21T07:48:00.000-07:00</published><updated>2011-04-21T07:48:20.936-07:00</updated><title type='text'>Model 1 Architecture</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Model 1 architecture is the easiest way of developing JSP based web&amp;nbsp;applications. It cannot get any easier. In Model 1, the browser directly accesses&amp;nbsp;JSP pages. In other words, user requests are handled directly by the JSP.&amp;nbsp;Let us illustrate the operation of Model 1 architecture with an example.&amp;nbsp;Consider a HTML page with a hyperlink to a JSP. When user clicks on the&amp;nbsp;hyperlink, the JSP is directly invoked. The servlet&amp;nbsp;container parses the JSP and executes the resulting Java servlet. The JSP contains&amp;nbsp;embedded code and tags to access the Model JavaBeans. The Model JavaBeans&amp;nbsp;contains attributes for holding the HTTP request parameters from the query&amp;nbsp;string. In addition it contains logic to connect to the middle tier or directly to the&amp;nbsp;database using JDBC to get the additional data needed to display the page. The&amp;nbsp;JSP is then rendered as HTML using the data in the Model JavaBeans and other&amp;nbsp;Helper classes and tags.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Problems with Model 1 Architecture&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Model 1 architecture is easy. There is some separation between content(Model JavaBeans) and presentation (JSP). This separation is good enough for &amp;nbsp;smaller applications. Larger applications have a lot of presentation logic. In&amp;nbsp;Model 1 architecture, the presentation logic usually leads to a significant amount&amp;nbsp;of Java code embedded in the JSP in the form of scriptlets. This is ugly and&amp;nbsp;maintenance nightmare even for experienced Java developers. In large&amp;nbsp;applications, JSPs are developed and maintained by page authors. The&amp;nbsp;intermingled scriptlets and markup results in unclear definition of roles and is&amp;nbsp;very problematic.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Application control is decentralized in Model 1 architecture since the next&amp;nbsp;page to be displayed is determined by the logic embedded in the current page.&amp;nbsp;Decentralized navigation control can cause headaches. All this leads us to Model&amp;nbsp;2 architecture of designing JSP pages.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii74T45YEYzKJLk7tIvMfumKCLVmm6ZRMiUFhopYgswitCe0Sr2s8Cf9MVu7tVw6PsQ38RXDUJ-_qtTd_hYxyM6oE4ry44fjeo8IzI4kENI7VInHWXJsjYE1UbgKaJGEsTdw-AUu_gMb0/s1600/2.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii74T45YEYzKJLk7tIvMfumKCLVmm6ZRMiUFhopYgswitCe0Sr2s8Cf9MVu7tVw6PsQ38RXDUJ-_qtTd_hYxyM6oE4ry44fjeo8IzI4kENI7VInHWXJsjYE1UbgKaJGEsTdw-AUu_gMb0/s320/2.gif&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinuj2ee.blogspot.com/feeds/7294908854186961049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/model-1-architecture.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/7294908854186961049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/7294908854186961049'/><link rel='alternate' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/model-1-architecture.html' title='Model 1 Architecture'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii74T45YEYzKJLk7tIvMfumKCLVmm6ZRMiUFhopYgswitCe0Sr2s8Cf9MVu7tVw6PsQ38RXDUJ-_qtTd_hYxyM6oE4ry44fjeo8IzI4kENI7VInHWXJsjYE1UbgKaJGEsTdw-AUu_gMb0/s72-c/2.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3262343092973867172.post-1168591287569279764</id><published>2011-04-21T07:31:00.000-07:00</published><updated>2011-04-21T07:31:21.691-07:00</updated><title type='text'>J2EE web application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Any web application that runs in the servlet container is called a J2EE web&amp;nbsp;application. The servlet container implements the Servlet and JSP specification.&amp;nbsp;It provides various entry points for handling the request &amp;nbsp;originating from a web&amp;nbsp;browser. There are three entry points for the browser into the J2EE web&amp;nbsp;application - Servlet, JSP and Filter. You can create your own Servlets by&amp;nbsp;extending the javax.servlet.http.HttpServlet class and implementing&amp;nbsp;the doGet() and doPost() method. You can create JSPs simply by creating a&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;text file containing JSP markup tags. You can create Filters by implementing the&amp;nbsp;javax.servlet.Filter interface.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The servlet container becomes aware of Servlets and Filters when they are&amp;nbsp;declared in a special file called web.xml 2. A J2EE web application has exactlyone web.xml file. The web &amp;nbsp;application is deployed into the servlet container by&amp;nbsp;bundling it in zipped archive called Web ARchive – commonly referred to as&amp;nbsp;WAR file.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A servlet is the most basic J2EE web component. It is managed by the servlet&amp;nbsp;container. All servlets &amp;nbsp;implement the Servlet interface directly or indirectly. In&amp;nbsp;general terms, a servlet is the endpoint for requests adhering to a protocol.&amp;nbsp;However, the Servlet specification mandates implementation for servlets that&amp;nbsp;handle HTTP requests only. But you should know that it is possible to implement&amp;nbsp;the servlet and the container to handle other protocols such as FTP too. When&amp;nbsp;writing Servlets for handling HTTP requests, you generally subclass HttpServlet&amp;nbsp;class. HTTP has six methods of request submission – GET, POST, PUT, HEAD&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;and DELETE. Of these, GET and POST are the only forms of request submission&amp;nbsp;relevant to application developers. Hence your subclass of HttpServlet should&amp;nbsp;implement two methods – doGet() and doPost() to handle GET and POST&amp;nbsp;respectively. Listing 1.1 shows a doGet() method from a typical Servlet.&amp;nbsp;With this background, let us now dive straight into presentation tier&amp;nbsp;strategies. This coverage of presentation tier strategies will kick start your&amp;nbsp;thought process on how and where Struts fits in the big picture.&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinuj2ee.blogspot.com/feeds/1168591287569279764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/j2ee-web-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/1168591287569279764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/1168591287569279764'/><link rel='alternate' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/j2ee-web-application.html' title='J2EE web application'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3262343092973867172.post-9105713736980984219</id><published>2011-04-21T07:29:00.000-07:00</published><updated>2011-04-21T07:29:02.759-07:00</updated><title type='text'>J2EE Platform</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;As you might be already knowing, J2EE is a platform for executing server&amp;nbsp;side Java applications. Before J2EE was born, server side Java applications were&amp;nbsp;written using vendor specific APIs. Each vendor had unique APIs and&amp;nbsp;architectures. This resulted in a huge learning curve for Java developers and&amp;nbsp;architects to learn and program with each of these API sets and higher costs for&amp;nbsp;the companies. Development community could not reuse the lessons learnt in the&amp;nbsp;trenches. Consequently the entire Java developer community was fragmented,&amp;nbsp;isolated and stunted thus making very difficult to build serious enterprise&amp;nbsp;applications in Java.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Fortunately the introduction of J2EE and its adoption by the vendors has&amp;nbsp;resulted in standardization of its APIs. This in turn reduced the learning curve for&amp;nbsp;server side Java developers. J2EE specification defines a whole lot of interfaces&amp;nbsp;and a few classes. Vendors (like BEA and IBM for instance) have provided&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;implementations for these interfaces adhering to the J2EE specifications. These&amp;nbsp;implementations are called J2EE Application Servers.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The J2EE application servers provide the infrastructure services such as&amp;nbsp;threading, pooling and transaction management out of the box. The application&amp;nbsp;developers can thus concentrate on implementing business logic. Consider a&amp;nbsp;J2EE stack from a developer perspective. At the bottom of the stack is Java 2&amp;nbsp;Standard Edition (J2SE). J2EE Application Servers run in the Java Virutal&amp;nbsp;Machine (JVM) sandbox. They expose the standard J2EE interfaces to the&amp;nbsp;application developers. Two types1 of applications can be developed and&amp;nbsp;deployed on J2EE application servers – Web applications and EJB applications.&amp;nbsp;These applications are deployed and executed in “container”s. J2EE specification&amp;nbsp;defines containers for managing the lifecycle of server side &amp;nbsp;components. There&amp;nbsp;are two types of containers - Servlet containers and EJB containers. Servlet&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;containers manage the lifecycle of web applications and EJB containers manage&amp;nbsp;the lifecycle of EJBs. Only Servlet containers are relevant to our discussion as&amp;nbsp;Struts, the theme of this book, is a web application framework.&amp;nbsp;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinuj2ee.blogspot.com/feeds/9105713736980984219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/j2ee-platform.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/9105713736980984219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3262343092973867172/posts/default/9105713736980984219'/><link rel='alternate' type='text/html' href='http://vinuj2ee.blogspot.com/2011/04/j2ee-platform.html' title='J2EE Platform'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>