JDev

Code, jstlDecember 5, 2007 6:55 pm

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}"/>

 

 

Code, dom, javascriptDecember 4, 2007 3:27 pm

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.