You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Barnicle <br...@barnicle.org> on 2002/07/02 04:52:45 UTC
I'm Lost - How to display ArrayList of Hashtables
Hey all... I've done this in many languages including Java, but I can't
seem to figure out how to do it in struts. For some reason the struts
paradigm is very difficult for me. Enough whining though. My situation
is that I have a search page. I search a directory given a person's
name. I retrieve a list of possible matches (or exact match) to that
name. I store the results in a bean
org.my.company.PeopleSearchResults. That's my first question. How do I
store this data? Right now, I have 'private ArrayList searchResults',
which gets populated when the object is constructed, then stored in the
request scope. Then the search gets forwarded to the search_results.jsp
page. I then have to display the attributes in certain places on the
page, like:
Name: <bean:write name="commonName">
Dept: <bean:write name="department">
etc., etc... What I have so far looks like this:
<bean:define id="resultsBean" name="peopleSearchResults" scope="request"
type="org.my.company.PeopleSearchResults" />
<logic:iterate
id="resultsIterator" name="resultsBean" property="searchResults">
This logic tag works ok, but inside here is where everything I've
tried so far falls apart.
</logic:iterate>
I _do_ have a property getter method in my bean, "public ArrayList
getSearchResults()", which seems to work ok. Am I doing this right so
far? What do I need to do to finish the job?
- M@
P.S. Struts 1.0.2, Tomcat
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>