Re: Action Messages
Hi, Ray, Why is what you are doing superior to the standard? The standard is something like the following and is very efficient, I think? On 5/27/05, Ray Madigan <[EMAIL PROTECTED]> wrote: > I am looking for the ability to handle the ActionMessage in a different way > in my application. In the validate method of the form I create a new > instance of ActionErrors and add ActionMessage instances to it. In the > Action dispatch method I call validate and get a non empty ActionErrors > instance. To figure how to make this work, I can get the iterator to the > keys and copy it to the request attribute like > > Iterator iter = errors.properties ( ); > request.setAttribute ( "ERRORS", errors ); > > but I can't get the messages associated with the property to allow me to > manipulate my page. > > What I would like is: > > for ActionErrors to be a collection, the I could iterate on the errors and > get the key and the values. I could iterate on the values, or reteive a > specific one. > > I want the ability to inspect an error condition and if it exists or not and > generate jsp accordingly with an error message. > > Does anyone know how to do this? > > it would look like, but I dream too much > > > > > > > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action Messages
Ray, it's not clear what you are trying to do that is different from standard. Struts puts the ActionErrors in the request by default. The Messages too. I used to know this inside out but it's been a year or so... but I think the key is like this: request.getAttribute(org.apache.struts.Globals.MESSAGE_KEY); request.getAttribute(org.apache.struts.Globals.ERROR_KEY); On 27/05/05 19:46 Ray Madigan wrote: I am looking for the ability to handle the ActionMessage in a different way in my application. In the validate method of the form I create a new instance of ActionErrors and add ActionMessage instances to it. In the Action dispatch method I call validate and get a non empty ActionErrors instance. To figure how to make this work, I can get the iterator to the keys and copy it to the request attribute like Iterator iter = errors.properties ( ); request.setAttribute ( "ERRORS", errors ); but I can't get the messages associated with the property to allow me to manipulate my page. What I would like is: for ActionErrors to be a collection, the I could iterate on the errors and get the key and the values. I could iterate on the values, or reteive a specific one. I want the ability to inspect an error condition and if it exists or not and generate jsp accordingly with an error message. Does anyone know how to do this? it would look like, but I dream too much - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action messages.
I'm not sure what you mean by "avoid 2 submit 's click". If your referring to the pooling method requiring a submit after the initial one (potential any number of submits really), then yes, you would avoid that. Here's an example off the top of my head (so the disclaimer is it might not be perfect!): Please wait, doing server work... Field A: Field B: Note the return faksel in the onClick of the submit button... I just did this so you'd see it work, without it the form submission proceeds and you won't see anything because you immediately get no return. Or something like that anyway :) The point is, remove that to try this for real against a real server. I think that'll do it, let me know if you need any further help. Frank From: "Marcelo Epstein" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: Re: Action messages. Date: Thu, 3 Jun 2004 13:55:11 -0300 Thanks Frank, Do you have any sample code of using ? I think this is also good to avoid 2 submit´s click. Am I right? - Original Message - From: "Frank Zammetti" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 03, 2004 11:57 AM Subject: RE: Action messages. > You can "fake it" and do this... have a hidden in your page that, > just before you submit your form, you display. You will probably also want > to wrap everything else in your page in a and hide it at the same > time. I say this is "faking it" because the browser won't have any idea > what's going on on the server, which might be OK. > > If you want some sort of progress bar though, something that actually has > knowledge of what's going on on the server, what you'll need to do is kick > off a thread in your Action, and store some reference to it persistently > (i.e., session or a database, etc.). Then, you'll have to have a page on > the browser with something like a meta-refresh that calls some special > Action that can check the status of that thread, maybe get some sort of > percent complete or something like that to display back to the browser. > > Obviously, if faking it is good enough, as it usually is in these cases, > that's by far the better choice. > > Frank > > >From: "Marcelo Epstein" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >Subject: Action messages. > >Date: Thu, 3 Jun 2004 11:46:44 -0300 > > > >Hi, > > > >I have a Action that takes 10s to execute. Is there any way to display > >messages in the browser during execution? > > > >Thx, > >Marcelo > > > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _ > MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months FREE! > http://join.msn.click-url.com/go/onm00200361ave/direct/01/ > > > - > 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] _ Get fast, reliable Internet access with MSN 9 Dial-up now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action messages.
Thanks Frank, Do you have any sample code of using ? I think this is also good to avoid 2 submit´s click. Am I right? - Original Message - From: "Frank Zammetti" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 03, 2004 11:57 AM Subject: RE: Action messages. > You can "fake it" and do this... have a hidden in your page that, > just before you submit your form, you display. You will probably also want > to wrap everything else in your page in a and hide it at the same > time. I say this is "faking it" because the browser won't have any idea > what's going on on the server, which might be OK. > > If you want some sort of progress bar though, something that actually has > knowledge of what's going on on the server, what you'll need to do is kick > off a thread in your Action, and store some reference to it persistently > (i.e., session or a database, etc.). Then, you'll have to have a page on > the browser with something like a meta-refresh that calls some special > Action that can check the status of that thread, maybe get some sort of > percent complete or something like that to display back to the browser. > > Obviously, if faking it is good enough, as it usually is in these cases, > that's by far the better choice. > > Frank > > >From: "Marcelo Epstein" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >Subject: Action messages. > >Date: Thu, 3 Jun 2004 11:46:44 -0300 > > > >Hi, > > > >I have a Action that takes 10s to execute. Is there any way to display > >messages in the browser during execution? > > > >Thx, > >Marcelo > > > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _ > MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months FREE! > http://join.msn.click-url.com/go/onm00200361ave/direct/01/ > > > - > 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: Action messages.
You can "fake it" and do this... have a hidden in your page that, just before you submit your form, you display. You will probably also want to wrap everything else in your page in a and hide it at the same time. I say this is "faking it" because the browser won't have any idea what's going on on the server, which might be OK. If you want some sort of progress bar though, something that actually has knowledge of what's going on on the server, what you'll need to do is kick off a thread in your Action, and store some reference to it persistently (i.e., session or a database, etc.). Then, you'll have to have a page on the browser with something like a meta-refresh that calls some special Action that can check the status of that thread, maybe get some sort of percent complete or something like that to display back to the browser. Obviously, if faking it is good enough, as it usually is in these cases, that's by far the better choice. Frank From: "Marcelo Epstein" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: Action messages. Date: Thu, 3 Jun 2004 11:46:44 -0300 Hi, I have a Action that takes 10s to execute. Is there any way to display messages in the browser during execution? Thx, Marcelo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 9 Dial-up Internet Access fights spam and pop-ups now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]