<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Web_Frameworks</id>
	<title>Web Frameworks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Web_Frameworks"/>
	<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=Web_Frameworks&amp;action=history"/>
	<updated>2026-04-16T19:03:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://luminoussheep.net/mediawiki/index.php?title=Web_Frameworks&amp;diff=62&amp;oldid=prev</id>
		<title>Martin: Created page with &quot;= Application framework = An application framework is a structure that already pre-defines the repetitive and hides the mundane. It should make the underlying technology easie...&quot;</title>
		<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=Web_Frameworks&amp;diff=62&amp;oldid=prev"/>
		<updated>2021-09-14T21:30:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Application framework = An application framework is a structure that already pre-defines the repetitive and hides the mundane. It should make the underlying technology easie...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Application framework =&lt;br /&gt;
An application framework is a structure that already pre-defines the repetitive and hides the mundane. It should make the underlying technology easier to use.&lt;br /&gt;
* Database access, acl, security, &lt;br /&gt;
* Data sanitisation, error handling, standards compliance, authentication, templating, localisation&lt;br /&gt;
* Control logic, assembling views&lt;br /&gt;
* Saves time and effort, has been already tested, may come with tooling&lt;br /&gt;
== Frameworks encourage ==&lt;br /&gt;
* Separation of business logic from presentation/interface - designed into the interfaces&lt;br /&gt;
* Separation of roles - developer/presentation&lt;br /&gt;
* Creation of components and the framework typically encourages this to conform to a standard&lt;br /&gt;
* Separation of stable code from volatile (GUI typically less stable)&lt;br /&gt;
&lt;br /&gt;
Object Decomposition: Splitting the application into objects and assigning these to tiers&lt;br /&gt;
&lt;br /&gt;
However have less control&lt;br /&gt;
&lt;br /&gt;
== Web tier frameworks ==&lt;br /&gt;
* typically based around MVC&lt;br /&gt;
** separation of model (persistence/behaviour), view (display) and controller (business logic/flow)&lt;br /&gt;
&lt;br /&gt;
=== Model 2 architecture ===&lt;br /&gt;
Separation of servlets (control) and JSP (display)&lt;br /&gt;
Servlet also single point for logging and security&lt;br /&gt;
(Model 1 - JSP page contains what page is next i.e. not servlet controller)&lt;br /&gt;
&lt;br /&gt;
Struts/JSF &lt;br /&gt;
Include a configurable controller servlet&lt;br /&gt;
Abstract classes for request dispatches&lt;br /&gt;
[Front Controller Pattern] is also a application of the [Mediator Pattern] as it decouples the views&lt;br /&gt;
Selection of next page based on model and session state&lt;br /&gt;
Identifying operation (see Blueprint web application framework)&lt;br /&gt;
* Use the servlet name and include a wildcard in the controller servelet mapping url&lt;br /&gt;
* Include in a hidden field&lt;br /&gt;
* Include in the URL as a parameter&lt;br /&gt;
Servlet mapping considered most flexible&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Web Tier =&lt;br /&gt;
* dynamic content&lt;br /&gt;
* controls flow&lt;br /&gt;
* maintains state&lt;br /&gt;
* MIME - many content types&lt;br /&gt;
* business logic for low traffic, simple transaction behaviour&lt;br /&gt;
&lt;br /&gt;
=== Web state ===&lt;br /&gt;
* Spec does not require recovery after crash&lt;br /&gt;
** some containers do provide this feature&lt;br /&gt;
** or persist state in the EIS tier&lt;br /&gt;
* Container manages session tracking with url rewriting/cookies - the associated with state&lt;br /&gt;
&lt;br /&gt;
==== Web state scope ====&lt;br /&gt;
* Application - servlet context&lt;br /&gt;
* Session - HttpSession (within the HttpServletRequest)&lt;br /&gt;
* Request - ServletRequest&lt;br /&gt;
&lt;br /&gt;
===== JSPs ===== &lt;br /&gt;
* Page - PageContext - active when forwarding/including&lt;br /&gt;
&lt;br /&gt;
When using EJBs recommended to use a stateful EJB to store state&lt;br /&gt;
* Thread safety easier in EJB (?)&lt;br /&gt;
* Automatic management - pooling, passivating when resources are limited&lt;br /&gt;
* Client independent&lt;br /&gt;
&lt;br /&gt;
When not using EJBs use the HttpSession to store state&lt;br /&gt;
&lt;br /&gt;
[[JSP Servlet shared bean example]]&lt;br /&gt;
&lt;br /&gt;
==== cookies ====&lt;br /&gt;
Avoid direct cookie manipulation unless direct need&lt;br /&gt;
* cookies can get corrupted&lt;br /&gt;
* cookies may be filtered/switched off&lt;br /&gt;
* size limitations - 4k&lt;br /&gt;
&lt;br /&gt;
== Servlets ==&lt;br /&gt;
* service oriented applications&lt;br /&gt;
* control functions - dispatching requests&lt;br /&gt;
* binary data&lt;br /&gt;
* program centric&lt;br /&gt;
* extend javax.servlet.http.HttpServlet&lt;br /&gt;
* can form filter chains&lt;br /&gt;
* lifecycle - listener interfaces&lt;br /&gt;
&lt;br /&gt;
=== Distributed Servlets ===&lt;br /&gt;
* constraits on session migration&lt;br /&gt;
&lt;br /&gt;
== JSP ==&lt;br /&gt;
* text based mark up - html, svg, wml, xml&lt;br /&gt;
* document centric&lt;br /&gt;
* must be converted into a servlet&lt;br /&gt;
* authoring tools&lt;br /&gt;
* JSP typically not well formed XML&lt;br /&gt;
** JSP alternate XML syntax allows checking file before runtime&lt;br /&gt;
&lt;br /&gt;
=== Custom Tags ===&lt;br /&gt;
* reusable (scripting is not)&lt;br /&gt;
* portable&lt;br /&gt;
* reduces repetition&lt;br /&gt;
* make intent clearer&lt;br /&gt;
&lt;br /&gt;
=== Java Standard Tag Library JSTL ===&lt;br /&gt;
* resource inclusion&lt;br /&gt;
* forwarding&lt;br /&gt;
* conditional logic&lt;br /&gt;
* iterators&lt;br /&gt;
* XSLT transformations&lt;br /&gt;
* state access&lt;br /&gt;
* internationalisation i8t2n&lt;br /&gt;
* forms (html)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upper layer built on lower layer&lt;br /&gt;
|------------&lt;br /&gt;
|JSTL | JSF |&lt;br /&gt;
|-----|--|  |&lt;br /&gt;
|JSP     |  |&lt;br /&gt;
|-----------|&lt;br /&gt;
|Servlets   |&lt;br /&gt;
|-----------|&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Web container =&lt;br /&gt;
* Services&lt;br /&gt;
** request dispatching&lt;br /&gt;
** concurrency&lt;br /&gt;
** lifecycle&lt;br /&gt;
* API&lt;br /&gt;
** naming &lt;br /&gt;
** transaction &lt;br /&gt;
** email &lt;br /&gt;
** session state &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Web application deployment descriptor&lt;br /&gt;
* defines deployment configuration&lt;br /&gt;
&lt;br /&gt;
RequestDispatcher &lt;br /&gt;
* include - combine multiple pages&lt;br /&gt;
* forward - send to another page to handle the response - response must be empty&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Servlet ==&lt;br /&gt;
* security&lt;br /&gt;
* control logic&lt;br /&gt;
** e.g. routing&lt;br /&gt;
* templating&lt;br /&gt;
* personalisation&lt;br /&gt;
* filters&lt;br /&gt;
* composite - include multiple JSPs&lt;br /&gt;
* forward to jsp for display&lt;br /&gt;
* binary data&lt;br /&gt;
* varying data structure&lt;br /&gt;
&lt;br /&gt;
Servlet - services&lt;br /&gt;
Servlet filter - customisation/extension&lt;br /&gt;
&lt;br /&gt;
binary output&lt;br /&gt;
    response.setHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;image/png&amp;quot;);&lt;br /&gt;
    OutputStream os = rsp.getOutputStream(); //or PrintWriter&lt;br /&gt;
&lt;br /&gt;
* only one servlet instance per definition&lt;br /&gt;
* SingleThreadModel servlets - pooled - discouraged&lt;br /&gt;
&lt;br /&gt;
=== Distributable ===&lt;br /&gt;
* state may be distributed/failed over - only session state&lt;br /&gt;
* Server affinity - load balancing more difficult&lt;br /&gt;
* State migration - increases network traffic&lt;br /&gt;
* State must be in the session&lt;br /&gt;
** Don&amp;#039;t use instance or static variables in servlet&lt;br /&gt;
** Don&amp;#039;t rely on the server specific ServletContext - can be used for caching&lt;br /&gt;
* context events are not distributed&lt;br /&gt;
	&lt;br /&gt;
== JSP ==&lt;br /&gt;
* for outputting text&lt;br /&gt;
* best for dynamic data but static structure&lt;br /&gt;
* HTML, XML, ASCII, postscript&lt;br /&gt;
* javax.servlet.jsp.JSPWriter used for output&lt;br /&gt;
** ensures proper encoding&lt;br /&gt;
** prevents binary content&lt;br /&gt;
* Use custom tags/servlet or helper calss for complex tasks&lt;br /&gt;
** avoid large use of control tags in JSP - hard to maintain&lt;br /&gt;
* should never forward or acting as a controller&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;%@ include file=&amp;quot;static.jsp&amp;quot; @%&amp;gt; - for static content&lt;br /&gt;
&amp;lt;jsp:include page=&amp;quot;DynamicServlet&amp;quot;/&amp;gt; - for dynamic (or static) content&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
include directive&lt;br /&gt;
* static - can cause servlet to be large&lt;br /&gt;
&lt;br /&gt;
jsp include&lt;br /&gt;
* dynamic - runtime overhead&lt;br /&gt;
* encoding can only be set once&lt;br /&gt;
&lt;br /&gt;
=== Custom tag/Scriptlets ===&lt;br /&gt;
&lt;br /&gt;
Use custom tag instead of include scripts (scriptlets)&lt;br /&gt;
* custom tags can be unit tested&lt;br /&gt;
* custom tags help keep separation of logic from presentation&lt;br /&gt;
* scripts are help separate role of html editor from programmer&lt;br /&gt;
* script errors can be harder to debug than custom tags&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Deliver plan for payment system&lt;br /&gt;
Review use cases and supplier payment documents. Highlight issues, write high level scoping document&lt;/div&gt;</summary>
		<author><name>Martin</name></author>
	</entry>
</feed>