<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; [Java][JSTL] создание класса для <c:forEach>]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=7611&amp;type=atom" />
	<updated>2010-10-20T15:25:12Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=7611</id>
		<entry>
			<title type="html"><![CDATA[Re: [Java][JSTL] создание класса для <c:forEach>]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=103179#p103179" />
			<content type="html"><![CDATA[<p>вопрос решён: необходимо было &quot;заимплементить&quot; Collection</p>]]></content>
			<author>
				<name><![CDATA[killergti]]></name>
				<uri>https://linuxforum.ru/profile.php?id=12123</uri>
			</author>
			<updated>2010-10-20T15:25:12Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=103179#p103179</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: [Java][JSTL] создание класса для <c:forEach>]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=103164#p103164" />
			<content type="html"><![CDATA[<p>текст ошибки:</p><div class="codebox"><pre><code>HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 55

52: 
53:             &lt;c:if test=&quot;${inputedFlag}&quot;&gt;
54:                 &lt;ul&gt;
55:                     &lt;c:forEach items=&quot;${books}&quot;&gt;
56:                         &lt;li&gt;
57:                             &lt;c:out value=&quot;test&quot; /&gt;
58:                         &lt;/li&gt;


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don&#039;t know how to iterate over supplied &quot;items&quot; in &amp;lt;forEach&amp;gt;
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:147)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

javax.servlet.jsp.JspTagException: Don&#039;t know how to iterate over supplied &quot;items&quot; in &amp;lt;forEach&amp;gt;
    org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:255)
    org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:219)
    org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:137)
    javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:227)
    org.apache.jsp.index_jsp._jspx_meth_c_005fforEach_005f0(index_jsp.java:334)
    org.apache.jsp.index_jsp._jspx_meth_c_005fif_005f0(index_jsp.java:304)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:135)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.

Apache Tomcat/6.0.26</code></pre></div>]]></content>
			<author>
				<name><![CDATA[killergti]]></name>
				<uri>https://linuxforum.ru/profile.php?id=12123</uri>
			</author>
			<updated>2010-10-20T15:02:40Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=103164#p103164</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[Java][JSTL] создание класса для <c:forEach>]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=103163#p103163" />
			<content type="html"><![CDATA[<p>Здравствуйте!</p><p>Возникла проблема при написании класса для тега forEach </p><p>JSP страница<br /></p><div class="codebox"><pre><code>&lt;%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%&gt;
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
   &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;

&lt;%@taglib uri=&quot;http://java.sun.com/jsp/jstl/core&quot; prefix=&quot;c&quot; %&gt;
...
    &lt;jsp:useBean id=&quot;books&quot; scope=&quot;session&quot; class=&quot;vanya.BookList&quot; /&gt;
...
            &lt;c:if test=&quot;${inputedFlag}&quot;&gt;
                &lt;ul&gt;
                    &lt;c:forEach var=&quot;book&quot; items=&quot;${books}&quot;&gt;
                        &lt;li&gt;
                            &lt;a href=&quot;${book.url}&quot;&gt;${book.title}&lt;/a&gt;
                        &lt;/li&gt;
                    &lt;/c:forEach&gt;
                &lt;/ul&gt;
            &lt;/c:if&gt;</code></pre></div><p>основной класс:<br /></p><div class="codebox"><pre><code>public class Book {
    public String title;
    public String url;

    public Book(String new_title, String new_url)
    {
        title = new_title;
        url = new_url;
    }
}</code></pre></div><p>класс-список для основного:<br /></p><div class="codebox"><pre><code>public class BookList implements Iterable&lt;Book&gt;
{
    public ArrayList&lt;Book&gt; book_list;

    public BookList()
    {
        book_list = new ArrayList&lt;Book&gt;(2);

        book_list.add(new Book(&quot;BookTitle_01&quot;,&quot;book_01.html&quot;));
        book_list.add(new Book(&quot;BookTitle_02&quot;,&quot;book_02.html&quot;));
    }

    @Override
    public Iterator&lt;Book&gt; iterator() {
        return book_list.iterator();
    }
}</code></pre></div><br /><p>Подскажите пожалуйста что я делаю не так.</p>]]></content>
			<author>
				<name><![CDATA[killergti]]></name>
				<uri>https://linuxforum.ru/profile.php?id=12123</uri>
			</author>
			<updated>2010-10-20T15:01:45Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=103163#p103163</id>
		</entry>
</feed>
