JSTL has a set of pre-defined objects such as pageScope, requestScope, param, paramValues and cookie.
If you have a cookie named ‘myCookie’, you can obtain its value as follows:
<c:out value="${cookie.myCookie.value}"/>
JSTL has a set of pre-defined objects such as pageScope, requestScope, param, paramValues and cookie.
If you have a cookie named ‘myCookie’, you can obtain its value as follows:
<c:out value="${cookie.myCookie.value}"/>
Custom Attributes for HTML Tags
Did you know that you can use any custom attributes for your HTML tags? For example:
<div id=’myDiv’ firstName=’John’></div>
Now, in your JavaScript code, you get the value of your custom attribute as follows:
var div = document.getElementById (’myDiv’);
var fName = div.getAttribute(’firstName‘);
This technique may prove useful if you manipulate and re-arrange HTML elements on your web page.