Head First Servlets and JSP

Get Started. It's Free
or sign up with your email address
Head First Servlets and JSP by Mind Map: Head First Servlets and JSP

1. Chap 4. Request and Response

1.1. Container

1.1.1. Runs multiples threads to process multiple requests to a single servlet

1.1.2. Create request and response objects

1.2. Servlet's life

1.2.1. 1. Load class

1.2.2. 2. Instantiate servlet (constructor runs)

1.2.3. 3. init()

1.2.4. 4. Service()

1.2.5. 5. destroy()

1.3. Http Methods

1.3.1. GET

1.3.2. POST

1.3.3. HEAD

1.3.4. TRACE

1.3.5. PUT

1.3.6. DELETE

1.3.7. OPTIONS

1.3.8. CONNECT


1.5. Request

1.5.1. String param = request.getParameter("parameter"); request.getParameterValues("size")[0];

1.5.2. String client = request.getHeader("User-Agent"); request.getIntHeader("foo");

1.5.3. Cookie[] cookies = request.getCookies();

1.5.4. HttpSession session = request.getSession();

1.5.5. String method = request.getMethod();

1.5.6. ServletInputStream input = request.getInputSream();

1.6. Response

1.6.1. response.setContentType("application/jar");

1.6.2. PrintWriter writer = response.getWriter(); writer.println("some text and HTML");

1.6.3. ServletOutputStream out = response.getOutputStream(); out.write(aByteArray);

1.6.4. response.setHeader("foo", "bar"); response.setIntHeader("TheAnswer", 42);

1.6.5. response.addHeader("foo", "bar");

1.6.6. response.addCookie(cookie);

1.6.7. reponse.sendError(404);

1.6.8. response.sendRedirect("foo/some/pic.jpg");

1.6.9. RequestDispatcher view = request.getRequestDispatcher("foo.jsp"); view.forward(request,response);

1.7. javax.servlet.ServletRequest

1.7.1. Methods getAttribute(String) getContentLenght() getinputStream() getLocalPort() getRemotePort() getServerPort() getParameter(String) getParameterValues(String) getParameterNames() more..

1.7.2. father of javax.servlet.http.HttpServletRequest Methods

1.8. javax.servlet.ServletResponse

1.8.1. Methods getBufferSize() setContentType() getOutputStream() getWriter() setContentLength() more..

1.8.2. father of javax.servlet.http.HttpServletResponse Methods

2. Chap 5. Attributes and Listeners

2.1. Context init Parameters

2.1.1. <web-app>   <context-param>     <param-name>foo</..     <param-value>bar</...

2.1.2. getServletContext.getInintParam("foo");

2.1.3. Available to any servlet and JSP part of the web app

2.2. Servlet init Parameters

2.2.1. <servlet>   <servlet-name>     <init-param>       <param-name>foo</..       <param-value>bar</...

2.2.2. getServletConfig.getInitParam("foo");

2.2.3. Available only to the servlet for which <init-param> was configured

2.3. ServletContext

2.3.1. getInitParameter(String) : String

2.3.2. getInitParameterNames() : String[]

2.3.3. getAttribute(String) : String

2.3.4. getAttributesName() : String[]

2.3.5. setAttributes(String, Object) : void

2.3.6. removeAttribute(String) : void

2.3.7. getRequestDispatcher(String) : RequestDispatcher

2.4. Listeners

2.4.1. <listener>   <listener-class>     com.some.foor.Listener   </..

2.4.2. the AttributeEvent.getValue, holds the replaced or removed value

2.4.3. Types javax.servlet.ServletContextListener : ServletContextEvent contextInitialized contextDestroyed javax.servlet.ServletRequestListener : ServletRequestEvent requestInitialized requestDestroyed javax.servlet.ServletContextAttributeListener : ServletContextAttributeEvent attributeAdded attributeRemoved attributeReplaced javax.servlet.ServletRequestAttributeListener : ServletRequestAttributeEvent attributeAdded attributeRemoved attributeReplaced javax.servlet.http.HttpSessionAttributeListener : HttpSessionBindingEvent attributeAdded attributeRemoved attributeReplaced javax.servlet.http.HttpSessionListener : HttpSessionEvent sessionCreated sessionDestroyed javax.servlet.http.HttpSessionBindingListener : HttpSessionBindingEvent valueBound valueUnbound javax.servlet.http.HttpSessionActivationListener : HttpSessionEvent sessionDidActive sessionWillPassivate

2.5. Attributes

2.5.1. Types Application/context Session Request

2.5.2. setAttribute(String name, Object value)

2.5.3. getAtrribute(String) : Object

2.5.4. removeAttribute(String) : void

2.5.5. getAttributeNames() : Enumeration

2.6. Parameters

2.6.1. Types Application/context init parameters Request Paratemers Servlet Iinit parameters

2.6.2. You CANNOT set Application and Servlet init parameters, they're set in the DD

2.6.3. getInitParameter(String) : String

2.7. RequestDispatcher

2.7.1. Methods forward(ServletRequest, ServletResponse) include(ServletRequest, ServletResponse)

2.7.2. RequestDispatcher view = request.getREquestDispatcher("result.jsp");

2.7.3. RequestDispatcher view = getServletContext().getRequestDispatcher("/result.jsp);

2.7.4. a flush often lead to an illegalStateException

2.7.5. getAttribute("javax.servlet.forward.query_string"); obtain the query string for the original access

2.7.6. if your servlet use an RD, it can never send its own response.

3. Chap 6. Session Managment

3.1. URL rewriting

3.1.1. Adds the session ID to the end of all URLs in the HTML that you write to the response

3.1.2. Is used to pass over the session ID when cookies are not supported but you need to explicitily encode all of the URLs you write

3.1.3. There's no way to get automatic URL rewriting with your static pages, so if you depend on sessions, you must use dynamically-generated pages

3.2. javax.servlet.http.HttpSession

3.2.1. getAttribute(String) : Object

3.2.2. getCreationTime() : long

3.2.3. getId() : String

3.2.4. getLastAcessedTime() : long

3.2.5. getMaxInactiveInterval(): int

3.2.6. getServletContext() : ServletContext

3.2.7. invalidate()

3.2.8. isNew(): boolean

3.2.9. removeAttribute(String)

3.2.10. setAttribute(String, Object)

3.2.11. setMaxInactiveInterval(int)

3.3. HttpServletRequsert

3.3.1. getSession()

3.3.2. getSession(boolean create new session if not exist)

3.4. Sessions

3.4.1. SSL has a built-in mechanism to define a session

3.4.2. URL rewriting

3.4.3. Cookies, the cookie name must be JSESSIONID

3.5. Ways a session die

3.5.1. Times out <web-app> <session-config> <session-timeout>15</... session.setMaxInactiveInterval(15*60);

3.5.2. invalidate()

3.5.3. App goes down

3.6. javax.servlet.http.Cookie

3.6.1. Cookie(String name, String value)

3.6.2. getDomain() : String

3.6.3. getMaxAge(): int

3.6.4. getName(): String

3.6.5. getPath() : String

3.6.6. getSecure(): boolean

3.6.7. getValue(): String

3.6.8. setDomain(String)

3.6.9. setMaxAge(int)

3.6.10. setPath(String)

3.6.11. SetValue(String)

3.7. Session Listeners

3.7.1. HttpSessionListener : HttpSessionEvent sessionCreated sessionDestroyed

3.7.2. HttpSessionActivationListener: HttpSessionEvent sessionDidActive sessionWillPassivate

3.7.3. HttpSessionBindingListener : HttpSessionBindingEvent valueBound valueUnbound

3.7.4. HttpSessionAttributeListener : HttpSessionBindingEvent attributeAdded attributeRemoved attributeReplaced

4. Chap 7. Using JSP

4.1. Jsp

4.1.1. Import <%@ page import="foo.*" %> <%@ page import="foo.*,java.util.*" %>

4.1.2. Elements <% %> <%@ %> <%= %> <%! %>

4.1.3. Template text is just a fucking text =/

4.1.4. implicit objects JspWriter : out HttpServletRequest : request HttpServletResponse : response HttpSession: session ServletContext : application SerlvetConfig : config Throwable : exception PageContext : pageContext Object : page

4.1.5. javax.servlet.jsp.JspPage jspInit() Access to jspDestroy() javax.servlet.jsp.HttpJspPage _jspService()

4.1.6. Attributes In a Servlet Application: getServletContext().setAttribute("foo", obj); Request: request.setAttribute("foo", obj); Session: request.getSession().setAttribute("foo", obj); Page: does not apply In a JSP Application : application.setAttribute("foo", obj) Request: request.setAttribute("foo", obj) Session : session.setAttribute("foo", obj) Page: pageContext.setAttribute("foo", obj)

4.1.7. pageContext Constants APPLICATION_SCOPE PAGE_SCOPE REQUEST_SCOPE SESSION_SCOPE Methods to get any implicit object getRequest() getServletConfigs() getServletContext() getSession() Inherited Methods from JspContext getAttribute(String name) getAttribute(String name, int scope) getAttributeNameInScope(int scope) findAttribute(String name)

4.1.8. Directives page Attributes Attributes outside of the examn taglib include

4.1.9. Disable scripting <jsp-config> <jsp-property-group> <url-pattern>*.jsp <scriptin-invalid> true .... EL <jsp-config> <jsp-property-group> <url-patter>*.jsp.. <el-ignored> true <% page isElIgnored="true">

4.1.10. Actions Standar action : <jsp:include page="Foo.jsp"/> Other action: <c:set var="rate" value="32" />

5. Chap 8. Scriptless JSP

5.1. EL

5.1.1. El expressions are always with curly braces, and prefixed with a dollar($) sign ${expression}

5.1.2. The first named variable in the expression is either an implicit object or an attribute in one of the four scopes (page, request, session or application)

5.1.3. The dot operator lets you access values by using a Map key or a bean property name. whatever comes to the right of the dot operator must follow normal Java naming rules

5.1.4. You can NEVER put anything to the right of the dot that wouldn't be legal as a Java identifire

5.1.5. The [] operator let you access arrays and lists when retrive the entire list only the first element is displayed, initParam.list is the same as initParam.list[0]

5.1.6. If what's inside the brackets is not in quotes, the container evaluates it. if it's in quotes, and it's not an index into an array or list, the container sees it as the literal name of a property or key

5.1.7. All but one of the EL implicit objects are Maps (PageContext)

5.1.8. the implicit object request is represented by requestScope implicit object on EL

5.1.9. You can use TLD to call java methods

5.1.10. Alrays inside of [] should have "" if it's not a number

5.1.11. If the dot operator is used to access a bean property but the prperty doesn't exist, then a runtime exception is thrown

5.2. Bean-Related

5.2.1. <jsp:useBean> Defines a variable that holds a reference to either an existing bean attribute or, if the bean doesn't already exist, create a new bean MUST have an "id" attribute which declares the variable name the "scope" attribute default is page The "class" attribute is optional, and it declares the class type that will be used if a new bean is created. The type must be public, non-abstract and have no-args constructor The "type" attribute must be a type to which the bean can be cast if you have "type" attribute but not have a "class" the bean must already exist This tag can have body, and anything in the body runs ONLY if a new bean is created <jsp:setProperty>

5.3. Include

5.3.1. mechanisms <%@ include FILE="header.html" %> does the include at translation time, only once <jsp:include PAGE="header.html" /> does the include at at runtime, every time! can customize an included file by setting a request parameter using <jsp:param> it's NOT possible to import the contents of any binary file into a JSP page

5.3.2. is position-sensitive directive

5.3.3. be sure to strip out the opening and closing tags.

5.3.4. Cannot change the response status code or set headers

5.4. Taglib declaration

5.4.1. <taglib> ... <function> <name>Some</.. <function-class>com.some.package.class</.. <function-signature>java.lang.String param (java.lang.String)</.. </... </...

5.5. <jsp:forward>

5.5.1. the response buffer is cleared first!, so anything written to the response before the forward will be thrown away

5.5.2. if you commit the response before the forwad (calling out.flush()), the forward won't happen, and the rest of the original page won't be processed

5.5.3. attribute Page

6. Chap 9. Using JSTL

6.1. Core Tags

6.1.1. <c:out /> Attributes value escapeXml attribute is optional, true as default default attribute is optional, the body of the c:out tag also works as default attribute

6.1.2. <c:forEach> Attributes var items varSatus can nest tags

6.1.3. <c:if> Attributes test doesn't have an else

6.1.4. <c:choose> <c:when> test <c:otherwise>

6.1.5. <c:set> Variables var scope, default page value, the body also works as value Beans or Maps target property value, the body also works as value

6.1.6. <c:remove> attributes var scope, is optinoal if not exist remove from ALL

6.1.7. <c:import> Attribute url value var add the contet from the value of url attribute to the current page, at request time (runtime) like jsp:include but it's more flexible can reach outside of the web app Body <c:param>

6.1.8. <c:catch> attirubte var

6.1.9. <c:forTokens>

6.1.10. <c:url>

6.1.11. <c:redirect>

6.2. Errors

6.2.1. Manually <%@ page isError="true"> ${pageContext.exception} <%@ page errorPage="errorPage.jsp">

6.2.2. DD <error-page> <exception-types>java.lang.Throwable</.. <location>/errorPage.jsp</... ... <error-page> <exception-type>java.lang.ArithmeticException</... <location>/arimeticError.jsp</... ... <error-page> <error-code>404</... <location>/notFoundError.jsp<... ....

6.3. TLD

6.3.1. declaration <?xml ...> <taglib xmlns...> <tlib-verion>1.2</tlib-verion> //mandatory <short-name>Random</short-name>//mandatory <function> //to be called on EL <name>rollIt</name> <function-class>foo.DiceRoller</function-class> <function-signature>int rollDice()</function-signature> </function> <uri>randomThings</uri> //unique! <tag> <description>randome advice</description>//optional <name>advice</name>//Required <tag-class>foo.AdvisorTagHandler</tag-class>//required <body-contet>empty</body-contet>//required <attribute> <name>user</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> </taglib> rtexprvalue, default is false body-contet uri <taglib> <taglib-uri>randomThings</.. <taglib-location>/WEB-INF/tag.tld</.. </...

6.3.2. class extends SimpleTagSupport override void doTag() all setters needed

6.3.3. usage <%@ taglib prefix="calis" uri="randomThings" %> <mine:advice user="${username}">

6.3.4. The TLD file can be placed in any subdirectory of WEB-INF

7. Chap 10. Custom tag Development

7.1. Tag handlers

7.1.1. Classic Extend TagSupport -> IterationTag -> Tag -> JspTag Life 1. Load class 2. Instantiate class (no-args constructor runs) 3. Call the SetPageContext(PageContext) 4. if the tag is nested setParent(Tag) 5. if the tag has attributes, call attributes setters 6. doStartTag() 7. if the tag is NOT declared to have an empty body, AND tag is NOT invoked with an empty body, AND the doStartTag() return EVAL_BODY_INCLUDE the body is evaluated 8. if the body is evauated doAfterBody() 9. doEndTag() pageContext.getOutput().println pageContext.implicitObjects

7.1.2. Classic BodyTag extend BodyTagSupport (implement bodyTag -> iterationTag-> Tag-> JspTag ) Life 1. Load class 2. Instantiate class (no-args constructor runs) 3. Call the SetPageContext(PageContext) 4. if the tag is nested setParent(Tag) 5. if the tag has attributes, call attributes setters 6. doStartTag() 7. setBodyContet() if Eval_body_buffered was returned 8. doInitBody() 9. if the tag is NOT declared to have an empty body, AND tag is NOT invoked with an empty body, AND the doStartTag() return EVAL_BODY_INCLUDE the body is evaluated 10. if the body is evauated doAfterBody() 11. doEndTag()

7.1.3. Simple Extend SimpleTagSupport --> SimpleTag --> JspTag To deploy it, must crate a TLD that describes the tag using the same <tag> element to use it with body, make sure the TLD <tag> for this tag does not declare <body-contet>empty. then call getJspBody().invoke(null) to cause the body to be processed Life 1. Load class 2. Instantiate class (no-args constructor runs) 3. Call setJspContext(jspContext) 4. If the tag is nested, call the setParent(JspTag) 5. If the tag has attributes, call attribute setters 6. if the tag is NOT decalred to have a <body-contet>empty.... and the tag has a body, call setJspBody(JspFragment) 7. doTag() can set attribute used by the body of the tag, calling getJspContext().setAttribute() followed by getJspBody().invoke() You can iterate over the body invoking the body (getJspBody.invoke()) in a loop the getJspBody() return a JspFragment methods Throw a SkipPageException if you want the current page to stop processing, if the page that invoked the ta was included from another page, the including page keeps going even though the included page stops processin from the moment the exception is thrown getJspContext().getOutput().println getJspContext().implicitobjects

7.2. Tag

7.2.1. Apply only to tags tag taglib jsp:doBdoy

7.2.2. directives but page

7.2.3. NOT Scripting

7.2.4. jsp:invoke

7.3. DynamicAttributes Interface

7.3.1. method setDynamicAttribute(String uri, String name, object, value)

7.3.2. <tag> <attribute>... <dynamic-attribute>true</dynamic-attribute> ...

7.3.3. <%@ tag body-contet="empty" dynamic-attribute="tagAttrs">

7.4. PageContext

7.4.1. extend from JspContext mehtods getAttributes(name) getAttribute(name, int scope) getAttributeNamesInScope(int scope) findAttribute(name)

7.4.2. methods getRequest() getServletConfig() getServletCnontext() getSession()

7.4.3. Scopes Application Page Request Session

8. Chap 11. Web App Deployment

8.1. Directory Structure

8.1.1. Webapps NameofTheApp *.jsp *html WEB-INF

8.1.2. War Webapps NameofTheApp

8.2. Mapping

8.2.1. <servlet> <servlet-name>Beer</servlet-name> <servlet-class>com.example.BeerSelect</servlet-class> </servlet> <servlet-mapping> <servlet-name>Beer</... <url-pattern>/Beer/SelectBeer.do</.. ...

8.2.2. Rules one Match 1. exact Match 2. directory match 3 extension match multiples match choose the longest mapp

8.3. Welcome file

8.3.1. <welcome-file-list> <welcome-file>index.html</... <welcome-file>default.jsp</.. </...

8.4. initialization

8.4.1. <servlet> <servlet-name>... <servlet-class>... <load-on-startup> number </.. ...

8.5. JSP Document (XML-based dcument)

8.5.1. Directives (except taglib) <%@ page import="java.util.*" %> <jsp:directive.page import="java.util.*"/>

8.5.2. Declaration <%! int y=3; %> <jsp:declaration> int y = 3; </jsp:declaration>

8.5.3. Scriptlet <%list.add("foo"); %> <jsp:scriptlet> list.add("foo"); </jsp:scriptlet>

8.5.4. text Simple text <jsp:text> Simple text </jsp:text>

8.5.5. scripting expression <%= it.next() %> <jsp:expression> it.next() </jsp:expression>

8.6. EJB

8.6.1. local <ejb-local-ref> <ejb-ref-name>ejb/Customer</.. <ejb-ref-type>Entity</.. <local-home>org.some.CustomerHome</... <local>org.some.Customer</... ......

8.6.2. remote <ejb-ref> <ejb-ref-name>ejb</... <ejb-ref-type>Entitiy</... <home>org.some.CustomerHome</.. <remote>org.some.Customer</.. ...

8.7. env-entry

8.7.1. <env-entry> <env-entry-name>rates/discountRate</.... <env-entry-type>java.lang.Integer</.. <env-entry-value>10</... ....

8.8. Mime

8.8.1. <mime-mapping> <extension>mpg</... <mime-type>video/mpeg</... .......

9. Chap 12. Web App Security

9.1. Realm: place where authentication information is stored

9.2. Authorization

9.2.1. Step 1. Defining roles tomcat-user.xml <tomcat-users> <role rolename="Admin"/> <role rolename="Member"/> <role rolename="Guest"/> <user username="Guti" password="secret" roles="Admin, Member, Guest"/> <user username="Ted" password="Tedsecret" roles="Guest"/> ........... DD <security-role><role-name>Admin</role-name></security-role> <security-role><role-name>Member</role-name></security-role> <security-role><role-name>Guest</role-name></security-role> <login-config> <auth-method>BASIC</... </...

9.2.2. Sept 2. Defining resource/method constrains DD <web-app> .... <web-resource-collection> <web-resource-collection> <web-resource-name>UpdateRecipes</.. <url-pattern>/Beer/AddRecipe/*</... <url-pattern>/Beer/ReviewRecipe/*</... <http-method>GET</... <http-method>POST</.... </web-resource-collection> <auth-constraint> <role-name>Admin</.. <role-name>Member</.. </.... <user-data-constraint> <transport-guarantee>CONFIDENTIAL</... </... </security-constraint> </web-app>

9.3. Multiples <security-constraint>

9.3.1. 1. when combinig individual role names, all of the roles names listed will be allowed

9.3.2. 2. A rle name of "*" combines with anything else to allow acces to everybody

9.3.3. 3. An empty <auth-constraint> tag combines with anything else to allow access to nobody, empty tag is always final word, nobody allowed

9.3.4. 4. if one <securty-constraint> has no <auth-constraint>, combines with anything else to allow access to everybody

9.4. Authentication types

9.4.1. BASIC

9.4.2. DIGEST


9.4.4. FORM <login-config> <auth-method>FORM</.. <form-login-config> <form-login-page>/loginPage.html</.. <form-error-page>/loginError.html</.. </.... </.... action= j_security_check j_username j_password

9.5. HttpServletRequest

9.5.1. isUserInRole("roleName")

9.5.2. getRemoteUser

9.5.3. getUserPrincipal()

10. Chap 13. Wrappers and Filters

10.1. javax.servlet.Filter

10.1.1. Methods init(FilterConfig config) doFilter(ServletRequest, ServletResponse, FilterChain) destroy()

10.1.2. Filters have no idea who's going to call them or who's next in line

10.2. Declaring (DD)

10.2.1. <filter> <filter-name>BeerRequest</.. <filter-class>com.example.SomeFilter</.. <init-param> <param-name>logFile</.. <param-value>Log.txt</... </init... ...

10.2.2. <filter-mapping> <filter-name>BeerRequest</.. <url-pattern>*.do</... ...

10.2.3. <filter-mapping> <filter-name>BeerRequest</.. <servlet-name>AdviceServlet</... ...

10.2.4. <dispatcher> REQUEST, default INCLUDE FORWARD ERROR

10.3. Decorator/Wrapper

10.3.1. wraps one kind of an object with an "enhanced" implementations (add new capabilities)

10.3.2. not necessary needs to override methods

10.4. Order rule

10.4.1. 1. All matching Url patterns

10.4.2. 2. Servlet-name

11. Chap 14. Patterns and Struts

11.1. Business Delegate

11.1.1. Features Acts as a proxy, implementing the remote service's interface initiates communications with a remote service handles communication details and exceptions receives request from a controller component translates the request and forwards it to the business services translate the response and returns it to the controller component by handling the details of remote component lookup and communications, allows controllers to be more cohesive

11.1.2. Principales based on hiding complexity coding to interfaces loose copuling separation of concerns minimizes the impact on the web tier when changes occur on the buisiness tier Reduces coupling between tiers Adds a layer to the app, which incrases complexity Methods calls to the Buisness Delegate should be a coarse-grained to reduce network traffic

11.2. Service Locator

11.2.1. Features Obtains InitialContext objects Performs registry lookups Handles communication details and exceptions Can improve perfomance by caching previously obtained references Works with a variety of registries such as: JNDI, RMI, UDDI, and COSS naming

11.2.2. Principales based on hiding complexity separation of concerns minimize the impact on the web tier when remote components change locations or containers Reduce coupling between tiers

11.3. Transfer Object

11.3.1. functions provides a local representation of a remote entity minimize network traffic can follow java bean conventions so that it can be easily accessed by other objects implemented as a serializable objects so that it can move across the network typically easily accessible by view components

11.3.2. principales based on reducing network traffic minimize the performance impact on the web tier when remote components data is accessed with fine-grained calls Reduces coupling between tiers a drawback is that components accessing the Transfer Object can receive out-of-data data, because transfer object's data is really representing sate that's stored somewhere elese. Making updatable transfer objects concurency-safe is typcally complex

11.4. Intercepting Filter

11.4.1. functions can intercept and/or modify request before they reach the servlet can intercept and/or modify the response before they are returned to the client Filters are deployed declaratively using the DD Filters are modular so that they can be exceuted in chains Filters have lifecycles managed by the container Filter must implemente Container callback methods

11.4.2. principales based on cohesion lose coupling increasing declarative control delcarative control allow filters to be easily implemented on either a temporary or permanent basis declarative control allows the sequence of invocation to be easily updated

11.5. Model View, Controller

11.5.1. features views can change independtly from controllres and model model components hide interal details, from the view and controllers if the model adheres to a stric contract,then these components can be reused in other app separation fo model code from controller code allows for easier migration to using remote buisness components

11.5.2. principales based on separation of concerns loose coupling increase cohesion in inividual components increase the overall complexity of the application minimize the impact of changes in other tiers of the application

11.6. Fron controller

11.6.1. features centralize a web app's initial request handling tasks in a single component using the fron controller with other patterns can provide loose coupling by making presentation tier dispatching declarative a drawback of front controller is that is' very barebons compared to strus

11.6.2. principales based on hiding complexity separation of concerns loose coupling increases cohesin in application controller components decreases the overall complexity of the application increases the maintainability of the inferastructure code