FROM THE BLOG

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.

adf_cookies_1

 

User fills up the form

adf_cookies_2

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;

adf_cookies_3

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

adf_cookies_4

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;

adf_cookies_5

 

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;

 

adf_cookies_6

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.

 

adf_cookies_7

 

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.