Showing posts with label jsp. Show all posts
Showing posts with label jsp. Show all posts

Wednesday, November 3, 2010

Reading cookies from browser in jsp

 <c:forEach items='${cookie}' var='mapEntry'> // reading cookies from any browser  
   <c:if test='${mapEntry.key eq "AllCookies"}'>  // reading from a map  
     <c:set var="str1" value="${mapEntry.value.value}"/>   
       <c:forEach var="num" items="${fn:split(str1, ',')}"> // spliting a cookie value  
         <c:out value='${num}'/>  
     </c:forEach>   
   </c:if>  
 </c:forEach>  

Friday, June 11, 2010

Access properties in jsp

.

<fmt:setbundle basename="Here we mention properties file name" scope="page" var="link"></fmt:setbundle>


<fmt:message bundle="${link}" key="test"></fmt:message>
key is the property we are looking for in the Example.properties file, and ${link} will get its value.


Tag library required for this operations is
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>


put Example.properties file under WEB-INF/classes/





Run Example.jsp you will get the above output