java - Retrieving cookie and array values in JSTL tags -


while retrieving cookies need use:

<c:foreach items="${cookie}" var="currentcookie">       ${currentcookie.value.name} </br> </c:foreach> 

but, while using custom arrays, why need skip .value function?

<c:foreach items="${mylist}" var="mylist">       ${mylist.name} </br> </c:foreach> 

cookie contains .getvalue function() returns content of cookie in string format, how using currentcookie.value.name work?

the ${cookie} points map<string, cookie> cookie name map key , cookie object map value. every iteration on map in <c:foreach> gives map.entry in turn has getkey() , getvalue() methods. confusion cookie object has in turn also getvalue() method.

<c:foreach items="${cookie}" var="currentcookie">       cookie name map entry key: ${currentcookie.key}<br/>     cookie object map entry value: ${currentcookie.value}<br/>     name property of cookie object: ${currentcookie.value.name}<br/>     value property of cookie object: ${currentcookie.value.value}<br/> </c:foreach> 

it's map<string, cookie> because allows easy direct access cookie value when know name beforehand. below example assumes cookiename:

${cookie.cookiename.value} 

your list example way invalid. var should not refer same name list itself.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -