You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Lars Hammer <ha...@dezide.com> on 2003/10/06 16:35:59 UTC

Struts

Hello

I'm playing around with Struts to see if i should build my search web app using the Struts framework. I began by making an Action which performs the search, and places the Hits object on the session. In my JSP page i figured I could use the Struts <logic:iterate> tag to iterate through the search results and display them accordingly.
The problem is that I get an exception saying "Cannot create iterator for this collection" when trying to iterate the Hits. I thought that Hits was an array of pointers to docs, hence Hits could be iterated over -but that seems to not be the case.

Has anyone any experience in using the <logic:iterate> tag or is it necessary to write a custom JSP tag which does the iteration??

Any help is greatly appreciated!

/Lars Hammer

Re: Struts

Posted by Tatu Saloranta <ta...@hypermall.net>.
On Monday 06 October 2003 08:35, Lars Hammer wrote:
...
> to iterate the Hits. I thought that Hits was an array of pointers to docs,

                                                                   ^^^
Actually, Hits contains a Vector (could be an array as well), but is not a 
Collection itself (one can not extend array classes in Java, so no Object 
besides basic arrays can be arrays or treates as one).
Hits be made a Collection, though.
In fact, I think it would be a reasonable thing to do, to make Hits be
a simple Collection (or perhaps List since it is an ordered collection).
You could file an RFE for this, or better yet, implement it. :-)
I'd think including such patch for Lucene would make sense as well.

> Has anyone any experience in using the <logic:iterate> tag or is it
> necessary to write a custom JSP tag which does the iteration??

No, it should be enough to write a simple wrapper that implements
Collection, and accesses Hits instance via next() method.

-+ Tatu +-


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


Re: Struts

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Hits is not a java.util.Collection, so you cannot directly iterate 
through it using <logic:iterate>.  There are some Lucene-specific tag 
libraries that may do what you're after within the 
jakarta-lucene-sandbox CVS repository (you'll have to check out that 
module and build them yourself, currently).

	Erik


On Monday, October 6, 2003, at 10:35  AM, Lars Hammer wrote:

> Hello
>
> I'm playing around with Struts to see if i should build my search web 
> app using the Struts framework. I began by making an Action which 
> performs the search, and places the Hits object on the session. In my 
> JSP page i figured I could use the Struts <logic:iterate> tag to 
> iterate through the search results and display them accordingly.
> The problem is that I get an exception saying "Cannot create iterator 
> for this collection" when trying to iterate the Hits. I thought that 
> Hits was an array of pointers to docs, hence Hits could be iterated 
> over -but that seems to not be the case.
>
> Has anyone any experience in using the <logic:iterate> tag or is it 
> necessary to write a custom JSP tag which does the iteration??
>
> Any help is greatly appreciated!
>
> /Lars Hammer


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