You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Andre Prasetya <an...@gmail.com> on 2007/04/19 06:38:05 UTC

c:forEach problem

Hi

i m new to jsp and jstl. i m using tomcat 5.5, and standard.jar

my taglib declaration is
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

the code that is in problem is
<c:forEach var="prod" items="${model.products}">
    ${prod.products} <i>${prod.price}</i><br/><br/>
</c:forEach>

the model declaration is as follows
        String now = new Date().toString();
        Map myModel = new HashMap();
        myModel.put("now", now);
        myModel.put("products", productManager.getProducts());

productManager.getProducts() will return a List

i get exception
org.apache.jasper.JasperException: /WEB-INF/jsp/hello.jsp(12,0) According to
TLD or attribute directive in tag file, attribute items does not accept any
expressions

where have i gone wrong ?

-- 
-Andre-

People see things the way they are and say "why ?" I see things that never
were and say "Why not ?"

Re: c:forEach problem

Posted by Ashmeet <a....@zensar.com>.
Hi, 
try using this ...<%@taglib prefix = "c"  uri =
"http://java.sun.com/jsp/jstl/core" %>
I also had same problem  which was solved by using above directive.
 
regards,
Ashmeet


Andre Prasetya-2 wrote:
> 
> Hi
> 
> i m new to jsp and jstl. i m using tomcat 5.5, and standard.jar
> 
> my taglib declaration is
> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> 
> the code that is in problem is
> <c:forEach var="prod" items="${model.products}">
>     ${prod.products} ${prod.price}<br/><br/>
> </c:forEach>
> 
> the model declaration is as follows
>         String now = new Date().toString();
>         Map myModel = new HashMap();
>         myModel.put("now", now);
>         myModel.put("products", productManager.getProducts());
> 
> productManager.getProducts() will return a List
> 
> i get exception
> org.apache.jasper.JasperException: /WEB-INF/jsp/hello.jsp(12,0) According
> to
> TLD or attribute directive in tag file, attribute items does not accept
> any
> expressions
> 
> where have i gone wrong ?
> 
> -- 
> -Andre-
> 
> People see things the way they are and say "why ?" I see things that never
> were and say "Why not ?"
> 
> 

-- 
View this message in context: http://www.nabble.com/c%3AforEach-problem-tf3604887.html#a12893918
Sent from the Taglibs - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: c:forEach problem

Posted by Andre Prasetya <an...@gmail.com>.
thanks pak,
kl dibaca lg di bawahnya dikasih tahu kl core_rt cuma buat servlet 2.3

On 4/19/07, Franz Reitinger <re...@utanet.at> wrote:
>
> See http://forum.java.sun.com/thread.jspa?threadID=683007&tstart=75
>
>
> You can use
> <%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
>
> or use the correct JSTL1.1 URI with as JSP2.0 container (prefered way):
> JSTL1.0 for Tomcat 4 (Servlet2.3 / JSP1.2)
> JSTL1.1 for Tomcat 5 (Servlet2.4/ JSP2.0)
>
>
> /franzR
>
>
>
> <zitiere wer="Andre Prasetya">
> > Hi
> >
> > i m new to jsp and jstl. i m using tomcat 5.5, and standard.jar
> >
> > my taglib declaration is
> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> >
> > the code that is in problem is
> > <c:forEach var="prod" items="${model.products}">
> >     ${prod.products} <i>${prod.price}</i><br/><br/>
> > </c:forEach>
> >
> > the model declaration is as follows
> >         String now = new Date().toString();
> >         Map myModel = new HashMap();
> >         myModel.put("now", now);
> >         myModel.put("products", productManager.getProducts());
> >
> > productManager.getProducts() will return a List
> >
> > i get exception
> > org.apache.jasper.JasperException: /WEB-INF/jsp/hello.jsp(12,0)
> > According to TLD or attribute directive in tag file, attribute items
> > does not accept any expressions
> >
> > where have i gone wrong ?
> >
> > --
> > -Andre-
> >
> > People see things the way they are and say "why ?" I see things that
> > never were and say "Why not ?"
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>


-- 
-Andre-

People see things the way they are and say "why ?" I see things that never
were and say "Why not ?"

Re: c:forEach problem

Posted by Andre Prasetya <an...@gmail.com>.
sorry i tought i m talking at indonesian mailing list.

i ve got the answer to the problem,
i should be using <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%>
as the one without /jsp dont support EL,

and there is another error about the calling of ${prod.products} it should
be ${prod.description}

On 4/19/07, Franz Reitinger <re...@utanet.at> wrote:
>
> See http://forum.java.sun.com/thread.jspa?threadID=683007&tstart=75
>
>
> You can use
> <%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
>
> or use the correct JSTL1.1 URI with as JSP2.0 container (prefered way):
> JSTL1.0 for Tomcat 4 (Servlet2.3 / JSP1.2)
> JSTL1.1 for Tomcat 5 (Servlet2.4/ JSP2.0)
>
>
> /franzR
>
>
>
> <zitiere wer="Andre Prasetya">
> > Hi
> >
> > i m new to jsp and jstl. i m using tomcat 5.5, and standard.jar
> >
> > my taglib declaration is
> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> >
> > the code that is in problem is
> > <c:forEach var="prod" items="${model.products}">
> >     ${prod.products} <i>${prod.price}</i><br/><br/>
> > </c:forEach>
> >
> > the model declaration is as follows
> >         String now = new Date().toString();
> >         Map myModel = new HashMap();
> >         myModel.put("now", now);
> >         myModel.put("products", productManager.getProducts());
> >
> > productManager.getProducts() will return a List
> >
> > i get exception
> > org.apache.jasper.JasperException: /WEB-INF/jsp/hello.jsp(12,0)
> > According to TLD or attribute directive in tag file, attribute items
> > does not accept any expressions
> >
> > where have i gone wrong ?
> >
> > --
> > -Andre-
> >
> > People see things the way they are and say "why ?" I see things that
> > never were and say "Why not ?"
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>


-- 
-Andre-

People see things the way they are and say "why ?" I see things that never
were and say "Why not ?"

Re: c:forEach problem

Posted by Franz Reitinger <re...@utanet.at>.
See http://forum.java.sun.com/thread.jspa?threadID=683007&tstart=75


You can use
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>

or use the correct JSTL1.1 URI with as JSP2.0 container (prefered way):
JSTL1.0 for Tomcat 4 (Servlet2.3 / JSP1.2)
JSTL1.1 for Tomcat 5 (Servlet2.4/ JSP2.0)


/franzR



<zitiere wer="Andre Prasetya">
> Hi
>
> i m new to jsp and jstl. i m using tomcat 5.5, and standard.jar
>
> my taglib declaration is
> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
>
> the code that is in problem is
> <c:forEach var="prod" items="${model.products}">
>     ${prod.products} <i>${prod.price}</i><br/><br/>
> </c:forEach>
>
> the model declaration is as follows
>         String now = new Date().toString();
>         Map myModel = new HashMap();
>         myModel.put("now", now);
>         myModel.put("products", productManager.getProducts());
>
> productManager.getProducts() will return a List
>
> i get exception
> org.apache.jasper.JasperException: /WEB-INF/jsp/hello.jsp(12,0)
> According to TLD or attribute directive in tag file, attribute items
> does not accept any expressions
>
> where have i gone wrong ?
>
> --
> -Andre-
>
> People see things the way they are and say "why ?" I see things that
> never were and say "Why not ?"




---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org