Dear Wiki user, You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.
The following page has been changed by MichaelJouravlev: http://wiki.apache.org/struts/StateManagement ------------------------------------------------------------------------------ Work in progress! - || - |||||||| Client Techniques |||| Server Techniques || + || |||||||||| Client Techniques |||| Server Techniques |||| Client + Server Techniques || - || - || Cookies || HTML form hidden fields |||| Rewritten URLs || Session || Database || + || || Cookies |||| Rewritten URLs || HTML form hidden fields || Browser Objects || Session || Database || Hidden fields + session || Hidden fields + database || - || - || - || - || Query parameters || Meaningful URLs || || || + || || || Query parameters || Meaningful URLs || || || || || || || - |||||||||||||| Advantages || + |||||||||||||||||||| Advantages || - || Relatively easy to code || + || || || || + || + || - || Can store complex data types || || || || || + || || + || Can store complex data types || || || || || + || + || || || || - || Works well in load balancing environments || + || + || + || + || || - || + || Works well in load balancing environments || + || + || + || + || + || || || || || + || Works well in Ajax applications || + || || || || + || + || || || || - |||||||||||| Disadvantages || + |||||||||||||||||||| Disadvantages || - || User can tamper with state information || + || + || + || + || || || + || User can tamper with state information || + || + || + || + || || || || || || - || Requires cookies || + || || || || + || || + || Requires cookies || + || || || || || + || || || || - || Requires coding || + || || || || + || || + || Requires coding || + || || || || + || + || || || || - || Can store only small amount of data (~2,000 bytes) || || || + || + || || || + || Can store only small amount of data (~2,000 bytes) || || + || + || || || || || || || - || Increased network traffic and slightly slower response times || + || + || + || + || || || + || Increased network traffic and slightly slower response times || + || + || + || + || || || || || || - || Requires server resources to save state information || || || || || + || + || + || Requires server resources to save state information || || || || || || + || || || || - || Application logic tightly coupled to the user interface implementation || || + || || || || || + || Application logic tightly coupled to the user interface implementation || || || || + || || || || || || + || State can be lost on page reload || || || || || + || || || || || + || State can be lost on direct navigation || || + || || + || + || || || || || - |||||||||||||| Neither Advantages Or Disadvantages || + |||||||||||||||||||| Neither Advantages Or Disadvantages || - || State and view not related || + || || || || + || || + || State is not tied to view || + || || || || + || + || || || || + == Cookies == + Pro: + * Not visible to a user + * Can be submitted to originating server only - better security + * Does not depend on request method (GET or POST) or how request is issued (HTML form, link, direct URL in the address bar) + * State is not linked to page address, can not get stale when a user navigates back on browser session history. + * State can be preserved after browser is closed (persistent cookies). + + Neither: + * State and page address are not related. + + Cons: + * Does not work if cookies are turned off + * Can have lifetime different from a user session, like can be saved for future sessions or can be explicitly removed during current session. + * Can store information about a particular client, session, or application. + + Best fit: non-critical user/client information usually employed for user profiling, like zip code or preferred language. == Rewritten URLs == @@ -107, +126 @@ Implications: Application must provide explicit navigational links and buttons so users would not have to use standard browser navigation buttons. Application must recognize and handle double-submit situations. Application must be able to synchronize client and server state. - == Cookies == - Pro: - * Not visible to a user - * Can be submitted to originating server only - better security - * Does not depend on request method (GET or POST) or how request is issued (HTML form, link, direct URL in the address bar) - * State is not linked to page address, can not get stale when a user navigates back on browser session history. - * State can be preserved after browser is closed (persistent cookies). - - Neither: - * State and page address are not related. - - Cons: - * Does not work if cookies are turned off - * Can have lifetime different from a user session, like can be saved for future sessions or can be explicitly removed during current session. - * Can store information about a particular client, session, or application. - - Best fit: non-critical user/client information usually employed for user profiling, like zip code or preferred language. - == Browser objects (DOM elements, Javascript variables, Flash storage) == Pro: * Can store complex structures and objects.
