If you do the following I am pretty sure it would work, assuming you are pasing in the id for dataManager.searchStories(id) .
Action class: ================ public class StorySearch extends ActionSupport implements Preparable { private List<Story> stories = null; private String id; //add getters and setters for id ... public void prepare() throws Exception{ if(id != null ){ stories = dataManager.searchStories(id); } } public String execute() throws Exception { ... for (Story story : stories) { System.out.println(" "+story.getId()); } return SUCCESS; } public List getStories() { return stories; } Struts.xml ============== Use the following in interceptor stack in the display action <interceptor-ref name="paramsPrepareParamsStack"/> If that doesn't work, I'm really not sure what to tell you. That was how I ended up getting my list to load. The interceptor stack will load the id from the request. Then run Prepare to get your list data before calling the jsp and execute. At least I believe that is how it works. -Scott -----Original Message----- From: Roberto Nunnari [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 20, 2007 12:49 PM To: Struts Users Mailing List Subject: Re: properties at times not found Hello Scott. ..but.. the list is a property of the action, and it's populated in the execute method.. the JSP, should be rendered after the execute method has returned, and so at that time it should be safe to get the stories from the action, as by now it should be set and ready. Do I miss anyhing? -- Robi. Scott Trafton wrote: > If you are trying to load your list by using a parameter passed in.. say > and Id from a link or another page, you might need to use the > paramsPrepareParamsStack interceptor and implement Preparable in you > action. > > I ran into a similar problem the other day. You would need to put your > code to populate the list in the Prepare() method. > > http://struts.apache.org/2.x/docs/crud-demo-i.html > > check out the "The prepare approach" in the above link. > > I hope this helps. > -Scott > > > -----Original Message----- > From: Roberto Nunnari [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 20, 2007 12:16 PM > To: Struts Users Mailing List > Subject: properties at times not found > > Hello. > > I have an action with a getter for a List. > In the execute method of the action I can verify the list is not empty. > But in the jsp view, at times it reports an empty list. > > > the action: > public class StorySearch extends ActionSupport { > private List<Story> stories = null; > ... > public String execute() throws Exception { > ... > stories = dataManager.searchStories(...); > for (Story story : stories) { > System.out.println(" "+story.getId()); > } > return SUCCESS; > } > > public List getStories() { > return stories; > } > > > the JSP: > <c:url var="storyURL" value="/StoryView.action"/> > <display:table name="${stories}" requestURI="storySearch.action"> > <display:column property="id" href="${storyURL}" paramId="id"/> > <display:column property="title"/> > <display:column property="text"/> > <display:column property="link" autolink="true"/> > <display:column property="accessCount" sortable="true"/> > <display:column property="creationDate" sortable="true"/> > <display:caption>This is the table caption</display:caption> > </display:table> > > > Any hints? > Thank you. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]