<?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=J2EE_Patterns_considerations</id>
	<title>J2EE Patterns considerations - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=J2EE_Patterns_considerations"/>
	<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=J2EE_Patterns_considerations&amp;action=history"/>
	<updated>2026-04-16T19:03:46Z</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=J2EE_Patterns_considerations&amp;diff=68&amp;oldid=prev</id>
		<title>Martin: Created page with &quot;= Front end design considerations = === Session state on client === * only good for small amounts of data * avoids problem of replicating data across servers Implementation *...&quot;</title>
		<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=J2EE_Patterns_considerations&amp;diff=68&amp;oldid=prev"/>
		<updated>2021-09-14T21:33:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Front end design considerations = === Session state on client === * only good for small amounts of data * avoids problem of replicating data across servers Implementation *...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Front end design considerations =&lt;br /&gt;
=== Session state on client ===&lt;br /&gt;
* only good for small amounts of data&lt;br /&gt;
* avoids problem of replicating data across servers&lt;br /&gt;
Implementation&lt;br /&gt;
* HTML hidden fields&lt;br /&gt;
* HTTP cookies&lt;br /&gt;
* URI encoding&lt;br /&gt;
Problems&lt;br /&gt;
* Expose state/information to client&lt;br /&gt;
* Data must be encoded as text&lt;br /&gt;
* performance of large quantities of data&lt;br /&gt;
&lt;br /&gt;
=== State on server ===&lt;br /&gt;
* identify with session id&lt;br /&gt;
* expire state on server shutdown/timout/explicit removal&lt;br /&gt;
Multiple front end options&lt;br /&gt;
* replicate state&lt;br /&gt;
* use server affinity&lt;br /&gt;
* store state on business tier/resource tier&lt;br /&gt;
&lt;br /&gt;
= Controlling access =&lt;br /&gt;
== Embed guard in a view ==&lt;br /&gt;
* Deny access to entire page (embedded guard tag only reasonable for few pages)&lt;br /&gt;
** use a central controller instead&lt;br /&gt;
* Deny access to portion of page&lt;br /&gt;
** wrap restricted section in a tag&lt;br /&gt;
&lt;br /&gt;
== Guard by configuration ==&lt;br /&gt;
* use features of servlet spec (2.2 but 2.3 more consistent) configure in web.xml&lt;br /&gt;
* supports part view and entire view&lt;br /&gt;
* unassigned = no direct access - may still forward to these pages&lt;br /&gt;
* prevent direct access - put page in WEB-INF directory&lt;br /&gt;
&lt;br /&gt;
== Duplicate form submission ==&lt;br /&gt;
* use controller servlet&lt;br /&gt;
* synchroniser - deja-vu token&lt;br /&gt;
** set token in session and in page&lt;br /&gt;
** submitted token must match session stored token&lt;br /&gt;
&lt;br /&gt;
== Validation ==&lt;br /&gt;
* Don&amp;#039;t rely on client side checks - scripting may be turned off / circumvented&lt;br /&gt;
Server side&lt;br /&gt;
* form based - typically duplication of code&lt;br /&gt;
* abstract types - separate validation model from application logic&lt;br /&gt;
** typically use metadata + constraints e.g. properties file&lt;br /&gt;
** may be slower and more complex - harder to maintain&lt;br /&gt;
** e.g. use factory for creating validators and xml config file&lt;br /&gt;
&lt;br /&gt;
== Helper properties ==&lt;br /&gt;
&amp;lt;jsp:setProperty name=&amp;quot;bean&amp;quot; property=&amp;quot;*&amp;quot;/&amp;gt;&lt;br /&gt;
* Sets matching name &amp;amp; type to value automatically&lt;br /&gt;
* Does _NOT_ set empty or null values =&amp;gt; may need to manually clear&lt;br /&gt;
* Check boxes only set items set =&amp;gt; may need to manually clear&lt;br /&gt;
&lt;br /&gt;
= Business tier design considerations =&lt;br /&gt;
== Storing state ==&lt;br /&gt;
* If all traffic via web interface - state may be stored in web server&lt;br /&gt;
* If via web &amp;amp; thick client - consider state in middle tier&lt;br /&gt;
* Consider clustering, server affinity, replication, persistence, traffic management&lt;br /&gt;
&lt;br /&gt;
== Session beans ==&lt;br /&gt;
* dedicated to a single client&lt;br /&gt;
* lives for duration of client&lt;br /&gt;
* transient - lives with the container - not persisted&lt;br /&gt;
* can time out&lt;br /&gt;
* can participate in transactions&lt;br /&gt;
* can be stateful or stateless&lt;br /&gt;
&lt;br /&gt;
* stateless - bean available as soon as method completes&lt;br /&gt;
* Scalability issues typically due to miss application of stateful/statless beans&lt;br /&gt;
** use stateful for instances requiring conversation&lt;br /&gt;
** multiple calls resending/persisting state is often the wrong design&lt;br /&gt;
&lt;br /&gt;
== Control code in multiple views ==&lt;br /&gt;
=&amp;gt; changes impact multiple pages&lt;br /&gt;
* Consolidate controle code&lt;br /&gt;
** introduce controller&lt;br /&gt;
** localise disparate logic&lt;br /&gt;
For similar control in multiple places&lt;br /&gt;
* view helper&lt;br /&gt;
* guarding a view&lt;br /&gt;
&lt;br /&gt;
== Don&amp;#039;t allow presentation tier objects into business tier ==&lt;br /&gt;
* copy state into generic object to share&lt;br /&gt;
* similarly for domain objects&lt;br /&gt;
&lt;br /&gt;
== Fat Controllers ==&lt;br /&gt;
Too much logic in one place&lt;br /&gt;
* factor out - delegate - use helpers&lt;br /&gt;
&lt;br /&gt;
== Helpers as scriptlets ==&lt;br /&gt;
* try and create interfaces that expose intent - meaning (e.g. using custom tags)&lt;br /&gt;
&lt;br /&gt;
= Entity beans =&lt;br /&gt;
* best suited to coarse grained logic&lt;br /&gt;
* mapping to persistence data&lt;br /&gt;
* transactional&lt;br /&gt;
* multi threaded&lt;br /&gt;
* long lived&lt;br /&gt;
* App server provides: scalability, security, clustering&lt;br /&gt;
* composite key&lt;br /&gt;
** must create separate object to represent key - serialisable&lt;br /&gt;
** attributes must be public - match name and type of entity bean&lt;br /&gt;
** should override equals and hash&lt;/div&gt;</summary>
		<author><name>Martin</name></author>
	</entry>
</feed>