ADF Tips: Cookies in ADF

Imagine this scenario; your ADF web application is wide open and there are no user management in the system. All operations are done anonymously and the requirement is that it should remain that way. The following use case  is to illustrate the situation and might not even make sense in a real world but will suffice the purpose of this post.

So this is how this use case works; We want to store the information about the person who is submiting the form.



User fills up the form


Once its submitted, cookies are stored in the web browser so next time user comes to the form he or she will be able to decide whether to fill up the form manually or by pressing a button;


Clickin on Fill it button will update the forms with the values that are stored as cookies in the browser.


The implementation goes like this; Identifying what are the attributes we want to store in the user’s browser as cookies using custom properties at entity level;



Because we want to store the cookies as soon as the user submits the form, we just need to get the IteratorBinding to get the current row and then iterate over the attributes and determine which are the ones we are interested in storing their values as a browser cookie;



Please note that I am not checking whether the value of the custom property is true or not because in my implementation, the attributes I wanted to store as a cookie were the only ones I gave the cookieable property so its enough to just check whether the property for the attribute is not null.




Bare in mind that depending on your application some information might be sensitive and cookies might not be a good idea but it all depends on the requirements.

Leave a comment

Your email address will not be published.

Social Media

Stay up-to-date with our latest ADF and related technical posts via your favourite social network services.