When iterating over a map, access the key & value with ${i.key} and ${i.value} 
respectively.

The JSTL spec is at http://www.columbia.edu/~nlevitt/specs/jstl-1_0-prd-spec.pdf and 
is really helpful.

Chris Harris
System Manager
STL Ltd.
PO Box 300, Carlisle, Cumbria, CA3 0QS
Ph. 01228 611811
Fax 01228 514949 

-----Original Message-----
From: Antony Paul [mailto:[EMAIL PROTECTED]
Sent: 05 December 2003 11:43
To: Tag Libraries Users List
Subject: Re: Calling a bean method in <c:out/>


I tried this it gives error.
/jstl1.jsp(12,25) equal symbol expected
<%@ page import="java.util.*"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
Sample using JSTL Core tags<br>
<%
 Map map = new HashMap();
 map.put("name","Anto Paul");
 map.put("Place","Ollur");
 map.put("Job","Programmer");
 request.setAttribute("list",map);
%>
<c:forEach var="i" items="${list}">
  <c:out value="${i["name"]}"/><br>
</c:forEach>

rgds
Antony Paul


----- Original Message -----
From: "Antony Paul" <[EMAIL PROTECTED]>
To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
Sent: Friday, December 05, 2003 3:53 PM
Subject: Re: Calling a bean method in <c:out/>


> Then any other way to do it using JSTL or Jakarta taglibs. This
functionaly
> is very useful because most pages uses the same technique to display
> content. I think Struts is providing similar functionality.
>
> Antony Paul.
>
> ----- Original Message -----
> From: "Martin van Dijken" <[EMAIL PROTECTED]>
> To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
> Sent: Friday, December 05, 2003 3:37 PM
> Subject: Re: Calling a bean method in <c:out/>
>
>
> > Hey Antony,
> >
> > It is correct that that gives an error. You see it is impossible to call
> >   methods in the Expression Language of JSTL. If your bean-class
> > implements java.util.Map however, it is possible to get the item you
> > want by using:
> >
> > <c:forEach var="i" items="${list}">
> >   <c:out value="${i["empno"]}"/><br>
> > </c:forEach>
> >
> > Grtz,
> >
> > Martin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - 
powered by MessageLabs. For further information visit http://www.mci.com .

_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - 
powered by MessageLabs. For further information visit http://www.mci.com .

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to