RE: properties at times not found
What is the implication of creating your model bean in the prepare() method *and* having Spring wired to inject the bean into the action? Scott Trafton wrote: > > Hi, > I have been getting the same errors from the Parameter interceptor. So > far I haven't found a way around that unless you put getters and setter > for all the parameters in the action. (Which I don't want). > However, the good news is that for better or worse, when/if you change > the settings in the struts.properties file and set struts.devMode = > false for production releases the messages go away. I'm not sure if > those errors are in there for debugging reasons or not. > > -Scott > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 21, 2007 9:53 AM > To: Struts Users Mailing List > Subject: Re: properties at times not found > > Hey Scott -- > > I am using ModelDriven and Preparable so I can pass an ID along with the > requests. I added an id attribute to my baseaction class and things are > working with one exception. Since the > prepare method is called before the getModel, when I post a form, and > the > prepare gets called, I am receiving multiple errors where parameters > could > not be set! > > 08:52:22,119 DEBUG > com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept:14 > 8 - > Setting params created => [ 6/8/07 3:28:27 PM.000 ] dojo.effectiveDate > => [ > 2007-06-20 ] action:PayrollUpdate_list => [ OK ] effectiveDate => [ > 6/20/07 > ] id => [ 2 ] version => [ 6/20/07 1:18:26 PM.000 ] > 08:52:22,129 ERROR > com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: > 204 > - ParametersInterceptor - [setParameters]: Unexpected Exception caught > setting 'created' on 'class actions.PayrollUpdateAction: Error setting > expression 'created' with value '[Ljava.lang.String;@30380' > 08:52:22,139 ERROR > com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: > 204 > - ParametersInterceptor - [setParameters]: Unexpected Exception caught > setting 'dojo.effectiveDate' on 'class actions.PayrollUpdateAction: > Error > setting expression 'dojo.effectiveDate' with value '[Ljava.lang.String > ;@1dad8eb' > 08:52:22,139 ERROR > com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: > 204 > - ParametersInterceptor - [setParameters]: Unexpected Exception caught > setting 'effectiveDate' on 'class actions.PayrollUpdateAction: Error > setting > expression 'effectiveDate' with value '[Ljava.lang.String;@d73fb7' > 08:52:22,169 ERROR > com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: > 204 > - ParametersInterceptor - [setParameters]: Unexpected Exception caught > setting 'version' on 'class actions.PayrollUpdateAction: Error setting > expression 'version' with value '[Ljava.lang.String;@19829a9' > > > > On 6/20/07, Scott Trafton <[EMAIL PROTECTED]> 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 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; >
RE: properties at times not found
Hi, I have been getting the same errors from the Parameter interceptor. So far I haven't found a way around that unless you put getters and setter for all the parameters in the action. (Which I don't want). However, the good news is that for better or worse, when/if you change the settings in the struts.properties file and set struts.devMode = false for production releases the messages go away. I'm not sure if those errors are in there for debugging reasons or not. -Scott -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 9:53 AM To: Struts Users Mailing List Subject: Re: properties at times not found Hey Scott -- I am using ModelDriven and Preparable so I can pass an ID along with the requests. I added an id attribute to my baseaction class and things are working with one exception. Since the prepare method is called before the getModel, when I post a form, and the prepare gets called, I am receiving multiple errors where parameters could not be set! 08:52:22,119 DEBUG com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept:14 8 - Setting params created => [ 6/8/07 3:28:27 PM.000 ] dojo.effectiveDate => [ 2007-06-20 ] action:PayrollUpdate_list => [ OK ] effectiveDate => [ 6/20/07 ] id => [ 2 ] version => [ 6/20/07 1:18:26 PM.000 ] 08:52:22,129 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: 204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'created' on 'class actions.PayrollUpdateAction: Error setting expression 'created' with value '[Ljava.lang.String;@30380' 08:52:22,139 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: 204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'dojo.effectiveDate' on 'class actions.PayrollUpdateAction: Error setting expression 'dojo.effectiveDate' with value '[Ljava.lang.String ;@1dad8eb' 08:52:22,139 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: 204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'effectiveDate' on 'class actions.PayrollUpdateAction: Error setting expression 'effectiveDate' with value '[Ljava.lang.String;@d73fb7' 08:52:22,169 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters: 204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'version' on 'class actions.PayrollUpdateAction: Error setting expression 'version' with value '[Ljava.lang.String;@19829a9' On 6/20/07, Scott Trafton <[EMAIL PROTECTED]> 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 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: > > > > > > > > > This is the table caption > > > > Any hints? > Thank you. > > -- > Robi > > > - > 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] > > -- Scott [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Dave Newton wrote: --- Roberto Nunnari <[EMAIL PROTECTED]> wrote: But what does that mean? I've just been chalking it up to magic. How can I find out what's going on? Do I have to keep the filter mapped? Probably. Are you using SiteMesh? In a nutshell, this No. But I'm using Tiles. filter tells the dispatcher filter not to clean up the action context and have it cleaned by this filter instead. So something may have been trying to access the action context after the filter dispatcher ran, which blows things up--I don't know and/or recall your configuration, but you could start looking based on what little I've told you ;) I'm looking up the API doc. Thank you. -- Robi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Hey Scott -- I am using ModelDriven and Preparable so I can pass an ID along with the requests. I added an id attribute to my baseaction class and things are working with one exception. Since the prepare method is called before the getModel, when I post a form, and the prepare gets called, I am receiving multiple errors where parameters could not be set! 08:52:22,119 DEBUG com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept:148 - Setting params created => [ 6/8/07 3:28:27 PM.000 ] dojo.effectiveDate => [ 2007-06-20 ] action:PayrollUpdate_list => [ OK ] effectiveDate => [ 6/20/07 ] id => [ 2 ] version => [ 6/20/07 1:18:26 PM.000 ] 08:52:22,129 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'created' on 'class actions.PayrollUpdateAction: Error setting expression 'created' with value '[Ljava.lang.String;@30380' 08:52:22,139 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'dojo.effectiveDate' on 'class actions.PayrollUpdateAction: Error setting expression 'dojo.effectiveDate' with value '[Ljava.lang.String ;@1dad8eb' 08:52:22,139 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'effectiveDate' on 'class actions.PayrollUpdateAction: Error setting expression 'effectiveDate' with value '[Ljava.lang.String;@d73fb7' 08:52:22,169 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'version' on 'class actions.PayrollUpdateAction: Error setting expression 'version' with value '[Ljava.lang.String;@19829a9' On 6/20/07, Scott Trafton <[EMAIL PROTECTED]> 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 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: This is the table caption Any hints? Thank you. -- Robi - 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] -- Scott [EMAIL PROTECTED]
Re: properties at times not found
--- Roberto Nunnari <[EMAIL PROTECTED]> wrote: > But what does that mean? I've just been chalking it up to magic. > How can I find out what's going on? > Do I have to keep the filter mapped? Probably. Are you using SiteMesh? In a nutshell, this filter tells the dispatcher filter not to clean up the action context and have it cleaned by this filter instead. So something may have been trying to access the action context after the filter dispatcher ran, which blows things up--I don't know and/or recall your configuration, but you could start looking based on what little I've told you ;) d. Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. http://answers.yahoo.com/dir/?link=list&sid=396545367 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Hello Dave. Yes. That helps! Now the JSP always get good data.. But what does that mean? How can I find out what's going on? Do I have to keep the filter mapped? Dave Newton wrote: One thing I've done when weird things are happening for no apparent reason is include the context cleanup filter; you can always see if that helps; map it before the struts dispatcher. contextCleanup org.apache.struts2.dispatcher.ActionContextCleanUp d. --- Roberto Nunnari <[EMAIL PROTECTED]> wrote: Hello list. Going on with investigation on this strange misbehaviour, I found out that when the JSP page gets good data, in the value stack I see: key: com.opensymphony.xwork2.dispatcher.HttpServletRequest value: [EMAIL PROTECTED] while when I get no data I see: key: com.opensymphony.xwork2.dispatcher.HttpServletRequest value: uri: /iopinion_hibernate00/storySearch.action somehow, I believe the interceptor stack is wrong.. maybe is my filter configuration?? I have added a filter in an attempt to use 'open session on view pattern' for use with hibernate. I believe that may be causing prolems, as I remember if the order was different the application would not work.. Should I use an interceptor instead? Here's a snipset from my web.xml * HibernateFilter com.foo.HibernateSessionRequestFilter struts2 org.apache.struts2.dispatcher.FilterDispatcher HibernateFilter /* struts2 /* * Can any kind soul help me, please? Thank you. -- Robi Roberto Nunnari wrote: 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 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: requestURI="storySearch.action"> href="${storyURL}" paramId="id"/> autolink="true"/> sortable="true"/> sortable="true"/> This is the table caption Any hints? Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Roberto Nunnari Servizi Informatici SUPSI-DTI SUPSI-DTI - Via Cantonale - 6928 Manno - Switzerland email: mailto:[EMAIL PROTECTED] tel: +41-58-561 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
One thing I've done when weird things are happening for no apparent reason is include the context cleanup filter; you can always see if that helps; map it before the struts dispatcher. contextCleanup org.apache.struts2.dispatcher.ActionContextCleanUp d. --- Roberto Nunnari <[EMAIL PROTECTED]> wrote: > Hello list. > > Going on with investigation on this strange > misbehaviour, I found > out that when the JSP page gets good data, in the > value stack > I see: > key: > com.opensymphony.xwork2.dispatcher.HttpServletRequest > value: > [EMAIL PROTECTED] > > while when I get no data I see: > key: > com.opensymphony.xwork2.dispatcher.HttpServletRequest > value: uri: /iopinion_hibernate00/storySearch.action > > somehow, I believe the interceptor stack is wrong.. > maybe > is my filter configuration?? I have added a filter > in an attempt > to use 'open session on view pattern' for use with > hibernate. > I believe that may be causing prolems, as I remember > if the > order was different the application would not work.. > > Should I use an interceptor instead? > > Here's a snipset from my web.xml > > * > >HibernateFilter > > com.foo.HibernateSessionRequestFilter > > > >struts2 > org.apache.struts2.dispatcher.FilterDispatcher > > > >HibernateFilter >/* > > > >struts2 >/* > > * > > > Can any kind soul help me, please? > > Thank you. > > -- > Robi > > Roberto Nunnari wrote: > > 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 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: > > > > requestURI="storySearch.action"> > > href="${storyURL}" paramId="id"/> > > > > > > autolink="true"/> > > sortable="true"/> > > sortable="true"/> > > This is the table > caption > > > > > > > > Any hints? > > Thank you. > > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Hello list. Going on with investigation on this strange misbehaviour, I found out that when the JSP page gets good data, in the value stack I see: key: com.opensymphony.xwork2.dispatcher.HttpServletRequest value: [EMAIL PROTECTED] while when I get no data I see: key: com.opensymphony.xwork2.dispatcher.HttpServletRequest value: uri: /iopinion_hibernate00/storySearch.action somehow, I believe the interceptor stack is wrong.. maybe is my filter configuration?? I have added a filter in an attempt to use 'open session on view pattern' for use with hibernate. I believe that may be causing prolems, as I remember if the order was different the application would not work.. Should I use an interceptor instead? Here's a snipset from my web.xml * HibernateFilter com.foo.HibernateSessionRequestFilter struts2 org.apache.struts2.dispatcher.FilterDispatcher HibernateFilter /* struts2 /* * Can any kind soul help me, please? Thank you. -- Robi Roberto Nunnari wrote: 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 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: This is the table caption Any hints? Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Jeff Amiel wrote: On 6/20/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: humm... If it's truly 'random' like that there are only 4 things that could be happening. 1. Display tag is broken (not likely) don't think so.. the same thing happens also with another action that puts a list (different name) in session via SessionAware and then I loop the list via and JSP EL (ie without using displaytag) 2. You occasionally have another element in some other scope with the same name that is being picked up 'first' in the search path by the value-stack logic (or display-tag's logic if you just do the name="stories") no. 3. Displaytag is taking a crap trying to render certain elements (calling toString() on them? because you have no decorator classes) based on different search results. (You never said..if you put in the same search parameters every time, do you always get the same results ("nothing found to display" or good data) always the same search.. in the action I get always the same data, in JSP "nothing found to display" or good data so.. don't think so.. see point 1 4. You are insane. :) That may be.. 5. libraries conflict? Best regards. -- Robi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
On 6/20/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: humm... If it's truly 'random' like that there are only 4 things that could be happening. 1. Display tag is broken (not likely) 2. You occasionally have another element in some other scope with the same name that is being picked up 'first' in the search path by the value-stack logic (or display-tag's logic if you just do the name="stories") 3. Displaytag is taking a crap trying to render certain elements (calling toString() on them? because you have no decorator classes) based on different search results. (You never said..if you put in the same search parameters every time, do you always get the same results ("nothing found to display" or good data) 4. You are insane. :) good luck! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Jeff Amiel wrote: On 6/20/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: Yes. That's it. It happens at random times.. not always. When it happens, all I get instead of the table in the browser is: Nothing found to display. makes no sensesure you don't have a local variable inside the execute method called stories or something equally silly?... hehe.. no I don't have a local variable inside the execute method.. in that case the instance variable would never get assigned.. or even better...maybe another element called 'stories' being put on the value stack on top of the action class element with the same name... no.. by the way, do you know what scope would stories be put in? request, session, application, page, or action? I assume action, as the variable is on the action, but I used to access it via JSP EL, that doesn't know about action scope, but only request, session, application and page scopes.. Doesn't display-tag have the ability to set the scope of the collection you are looking for (like sessionScope. as aprefix or requestScope.)..instead of the OGNL stuff with the name="${stories}", just do name="stories". Displaytag should just find it automagically...or you can play with those prefixes to try to pinpoint it in case some other element with same name is being placed first in the search path. I didn't know I could use just name="stories". I tried that and it works.. but just like before, at random times, the view doesn't find the property, even though the execute method prints them on stdout. humm... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
On 6/20/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: Yes. That's it. It happens at random times.. not always. When it happens, all I get instead of the table in the browser is: Nothing found to display. makes no sensesure you don't have a local variable inside the execute method called stories or something equally silly?... or even better...maybe another element called 'stories' being put on the value stack on top of the action class element with the same name... Doesn't display-tag have the ability to set the scope of the collection you are looking for (like sessionScope. as aprefix or requestScope.)..instead of the OGNL stuff with the name="${stories}", just do name="stories". Displaytag should just find it automagically...or you can play with those prefixes to try to pinpoint it in case some other element with same name is being placed first in the search path. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Hi Jeff. Jeff Amiel wrote: On 6/20/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: 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. Are you saying that 'sometimes' when the search actually brings back results (and you output it via that for loop in the action) that the display-tag section in the jsp is blank...? Not all the time? Yes. That's it. It happens at random times.. not always. When it happens, all I get instead of the table in the browser is: Nothing found to display. ...? I'd add title parameters to the display:column elements and see if displaytag is dying just trying to find the stories list or if it is finding an empty list. I added the title parameters to the display:column elements and the result is just like before: Nothing found to display. Any more hints? Thank you. -- Robi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
On 6/20/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: 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. Are you saying that 'sometimes' when the search actually brings back results (and you output it via that for loop in the action) that the display-tag section in the jsp is blank...? Not all the time? ...? I'd add title parameters to the display:column elements and see if displaytag is dying just trying to find the stories list or if it is finding an empty list. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: properties at times not found
Hello, i had a similar problem, u may need a concrete implementation for your property something like: private List stories = new LinkedList(); public List getStories() { return stories; } and make sure to override toString() in your Story class... don't know what else to tell ya. Good Luck...:) Roberto Nunnari wrote: > > 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 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: > > > > > > > > > This is the table caption > > > > Any hints? > Thank you. > > -- > Robi > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/properties-at-times-not-found-tf3953428.html#a11219495 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: properties at times not found
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 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 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 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: > > > > > > > > > This is the table caption > > > > 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]
Re: properties at times not found
Hi again Scott. I tried anyways adding to my struts.xml but it doesn't help.. Any more hints? Roberto Nunnari wrote: 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 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: This is the table caption Any hints? Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Roberto Nunnari Servizi Informatici SUPSI-DTI SUPSI-DTI - Via Cantonale - 6928 Manno - Switzerland email: mailto:[EMAIL PROTECTED] tel: +41-58-561 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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 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: This is the table caption Any hints? Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: properties at times not found
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 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: This is the table caption Any hints? Thank you. -- Robi - 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]
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 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: This is the table caption Any hints? Thank you. -- Robi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]