struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Barnicle <broke...@barnicle.org>
Subject I'm Lost - How to display ArrayList of Hashtables
Date Tue, 02 Jul 2002 02:52:45 GMT
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:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message