FIFO ordering of ActionErrors
Hi listers, I have been working on this issue for the last couple of days but haven't found any satisfactory answers through the usual channels (mailing list archives, API, and some source code perusal as well). As I understand it, post struts 1.1, ActionErrors were supposed to keep their FIFO ordering. I have tried a nightly from 2004-01-27 and just recently 2004-03-23 and here's what I experience: * all of my forms extend ValidatorForm * In one of those forms I override the validate method which first makes a call to super.validate() * If the above call returns any errors, I wanted to stick a prefix (or suffix) message in front of the errors shown by validator. For the sake of simplicity, the rest of discussion will focus on adding a suffix message (as its a lot easier to describe how I added the suffix message). So, instead of seeing the regular (boring :-)) messages from validator like: * 'Postal Code' is a required field. * 'City' is a required field. the user would instead see: * 'Postal Code' is a required field. * 'City' is a required field. * Invalid and/or incomplete input. Please provide the correct information as instructed: Here's a look at the errors object from the debug log before the insertion of the suffix message. { postalCode=[errors.required[Postal Code, null, null, null]], city=[errors.required[City, null, null, null]] } (BTW, to make the message appear before the other ones as a prefix, I had to create a new errors object and then add the original ones to it). So the following code line example just tries to add an ActionMessage with resource errors.validator.prefix [sic] at the end. So, after making my super.validate() call, I added a call to: errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(errors.validator.prefix)); I would have expected the above line to just add a 3rd property at the end. Unfortunately, the errors object now looks like: { postalCode=[errors.required[Postal Code, null, null, null]], org.apache.struts.action.GLOBAL_MESSAGE=[errors.validator.prefix[]], city=[errors.required[City, null, null, null]] } (Notice the GLOBAL_MESSAGE property stuck in the middle) With the result being that the user sees: * 'Postal Code' is a required field. * Invalid and/or incomplete input. Please provide the correct information as instructed: * 'City' is a required field. Did I understand the FIFO capability of ActionErrors incorrectly? If this helps any, postalCode is one of the only few fields that I have discovered in all of my forms which bubbles up to the top. Any help is appreciated. Thanks, -- Haroon Rafique [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Links within ActionErrors
I know this probably violates some basic guidlines but... I am trying to display an html link rendered by the message in the ActionErrors section of a JSP. My problem is that the '' and '' symbols are being replaced by ' l t;' and ' # 034;' (their equivelent) How can I prevent this translation from happening? Example: In the applicationresources file we have something like the following: error.save.dup.link=a href={0}click for details/a The action class creates the actual link address and adds an actionError as follows: tActionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.save.dup.link, iRequest.getRequestURL().substring(0,iRequest.getRequestURL().lastIndexOf(/ )) + /blah blah blah )); saveErrors(iRequest, tActionErrors); In the JSP we have tags to dislay the errors: logic:messagesPresent tabletrtd bspan id=errorsHeaderbean:message key=errors.validation.header//span/b html:messages id=error c:out value=${error}/ /html:messages /td/tr/table /logic:messagesPresent When the error is displayed because the '' and '' signs have been replaced it just show the text as follows: a href=http://localhost:8080/blah blah blah click to see /a - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Links within ActionErrors
Use c:out value=${error} escapeXml=false/ robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 1:43 PM To: [EMAIL PROTECTED] Subject: Links within ActionErrors I know this probably violates some basic guidlines but... I am trying to display an html link rendered by the message in the ActionErrors section of a JSP. My problem is that the '' and '' symbols are being replaced by ' l t;' and ' # 034;' (their equivelent) How can I prevent this translation from happening? Example: In the applicationresources file we have something like the following: error.save.dup.link=a href={0}click for details/a The action class creates the actual link address and adds an actionError as follows: tActionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.save.dup.link, iRequest.getRequestURL().substring(0,iRequest.getRequestURL().lastIndexOf(/ )) + /blah blah blah )); saveErrors(iRequest, tActionErrors); In the JSP we have tags to dislay the errors: logic:messagesPresent tabletrtd bspan id=errorsHeaderbean:message key=errors.validation.header//span/b html:messages id=error c:out value=${error}/ /html:messages /td/tr/table /logic:messagesPresent When the error is displayed because the '' and '' signs have been replaced it just show the text as follows: a href=http://localhost:8080/blah blah blah click to see /a - 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: problem with adding ActionMessage to ActionErrors
Use *html:messages id=msg message=false bean:write name=msg/ /html:messages* instead of *html:errors* Bradford M. Ayers wrote: I noticed in the documentation that ActionError is deprecated, so I was trying to be a good doobie and use ActionMessage like the docs say to. So in my code, when I go from this: errors.add( ActionErrors.GLOBAL_ERROR, new ActionMessage( error.password.mismatch )); to this: errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( error.password.mismatch )); when my page tries to resolve html:errors/ I get: java.lang.ClassCastException at org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215)... Has anyone seen this? I'm using JBoss 3.2.2 (which uses Tomcat 4.1). Brad Ayers Senior Programmer Analyst Granite State Management and Resources [EMAIL PROTECTED] 603-225-5867 ext. 308 603-224-2581 Fax number CONFIDENTIALITY NOTICE This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
redirects / actionErrors
Hi, I am using action errors as a means of passing messages to the request: e.g. in Action, execute method... errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(message.to.user)); saveErrors(request, errors); return mapping.findForward(Constants.REDIRECT_KEY); But if I redirect from this action to another forward that is also an action, the actionError is out of scope. I would be interested to know if (a) this is good practice - to forward to another forward (it seems to work for me) (b) there is an easy way to carry the actionError forward within storing in the session, and saving it in the redirected request. Hope I'm making sense, Thanks, al
Re: redirects / actionErrors
Hi, I don't know if i could understand your doubt (correct me if i'm wrong) but you must forward to your .jsp page and not redirect... If you have a global forward (in your struts-config.xml) like forward name=/my_forward_name path=/my_jsp.jsp redirect=false\ the request will be forwarded to the .jsp resource. But if you have forward name=/my_forward_name path=/my_jsp.jsp redirect=true\ the request will redirected (then you will lose the attributes in your request) mucus snot wrote: Hi, I am using action errors as a means of passing messages to the request: e.g. in Action, execute method... errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(message.to.user)); saveErrors(request, errors); return mapping.findForward(Constants.REDIRECT_KEY); But if I redirect from this action to another forward that is also an action, the actionError is out of scope. I would be interested to know if (a) this is good practice - to forward to another forward (it seems to work for me) (b) there is an easy way to carry the actionError forward within storing in the session, and saving it in the redirected request. Hope I'm making sense, Thanks, al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirects / actionErrors
Hi, I am intending to use a redirect rather than a forward. For me, it adds clarity for the user, and also if they refresh the page, they may get something unexpected. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirects / actionErrors
Ok, but i think you will lose your request attributes (because redirect will generate a new request from your browser)...Session or application attributes will be preserved. mucus snot wrote: Hi, I am intending to use a redirect rather than a forward. For me, it adds clarity for the user, and also if they refresh the page, they may get something unexpected. Al - 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: redirects / actionErrors
Struts 1.2 has a feature you can use that allows you to store your ActionMessages in session variables, then have it removed once they're accessed. I haven't used this yet, but you can probably build on this by storing your errors before you redirect, then have them displayed by the resource your redirected to. Another option is the extensions at http://www.rabago.net/struts/redirect which actually adds your messages (error or not) to the url paramters and puts them back on the ActionMessages queue upon redirection. hth, Hubert --- mucus snot [EMAIL PROTECTED] wrote: Hi, I am using action errors as a means of passing messages to the request: e.g. in Action, execute method... errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(message.to.user)); saveErrors(request, errors); return mapping.findForward(Constants.REDIRECT_KEY); But if I redirect from this action to another forward that is also an action, the actionError is out of scope. I would be interested to know if (a) this is good practice - to forward to another forward (it seems to work for me) (b) there is an easy way to carry the actionError forward within storing in the session, and saving it in the redirected request. Hope I'm making sense, Thanks, al __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors deprecated?
Hi Wendy! On 2004-02-09 at 13:04:36 -0700, Wendy Smoak wrote: ... I was trying to get it straight recently, and made this note to myself: In the Action: ActionMessages am = new ActionMessages(); am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( not.authorized.for.account ) ); saveErrors( request, am ); where does this come from? can't find it in struts 1.1 ... thx, Axel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
hi its code from 1.2-dev there is saveErrors with ActionErrors deprecated and a new saveErrors with ActionMessages http://jakarta.apache.org/struts/api/org/apache/struts/action/Action.htm l in 1.1 there is only saveErrors() with ActionErros (This will be removed after Struts 1.2) and saveMassages with ActionMessages btw. a new saveMessages() is also there for saving in session greetings matthias -Original Message- From: Axel Groß [mailto:[EMAIL PROTECTED] On Behalf Of Axel Groß Sent: Tuesday, February 17, 2004 1:28 PM To: Struts Users Mailing List Subject: Re: ActionErrors deprecated? Hi Wendy! On 2004-02-09 at 13:04:36 -0700, Wendy Smoak wrote: ... I was trying to get it straight recently, and made this note to myself: In the Action: ActionMessages am = new ActionMessages(); am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( not.authorized.for.account ) ); saveErrors( request, am ); where does this come from? can't find it in struts 1.1 ... thx, Axel - 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]
ActionErrors deprecated?
While refreshing my memory on the ActionErrors class, I noticed that the metho: void add (String, ActionError) Is deprecated, in favor of: void add(String, ActionMessage) with a note that this (first signature) method will be removed after Struts 1.2. What exactly is this trying to tell us? Are we supposed to drop ActionError entirely in favor of ActionMessage? There's no deprecation note in the description of ActionError. What's happening here? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors deprecated?
Yes, we're supposed to use ActionMessage and ActionMessages now. The one place where we can't escape ActionError/s yet is ActionForm's validate method. --- Slattery, Tim - BLS [EMAIL PROTECTED] wrote: While refreshing my memory on the ActionErrors class, I noticed that the metho: void add (String, ActionError) Is deprecated, in favor of: void add(String, ActionMessage) with a note that this (first signature) method will be removed after Struts 1.2. What exactly is this trying to tell us? Are we supposed to drop ActionError entirely in favor of ActionMessage? There's no deprecation note in the description of ActionError. What's happening here? -- Tim Slattery [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
From: Hubert Rabago [mailto:[EMAIL PROTECTED] Yes, we're supposed to use ActionMessage and ActionMessages now. The one place where we can't escape ActionError/s yet is ActionForm's validate method. I was trying to get it straight recently, and made this note to myself: In the Action: ActionMessages am = new ActionMessages(); am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( not.authorized.for.account ) ); saveErrors( request, am ); In the JSP: html-el:messages id=msg message=false c:out value=${msg}/ /html-el:messages http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsMessages -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
Yes, we're supposed to use ActionMessage and ActionMessages now. The one place where we can't escape ActionError/s yet is ActionForm's validate method. Wait a minute!!! ActionError is marked as deprecated, but not ActionErrors. It looks to me like we create an ActionMessage, add that to an ActionErrors collection, and use html:errors/ to display the contents of that on the JSP page. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
Hi Tim, yes only Error, not Errors, because of validate() in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages cheers, ! matthias -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 9:14 PM To: 'Struts Users Mailing List' Subject: RE: ActionErrors deprecated? Yes, we're supposed to use ActionMessage and ActionMessages now. The one place where we can't escape ActionError/s yet is ActionForm's validate method. Wait a minute!!! ActionError is marked as deprecated, but not ActionErrors. It looks to me like we create an ActionMessage, add that to an ActionErrors collection, and use html:errors/ to display the contents of that on the JSP page. -- Tim Slattery [EMAIL PROTECTED] - 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: ActionErrors deprecated?
in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages Maybe I'm dumb, but I can't make any sense of this. Use it for what? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
There's one thing I forgot to mention. That statement I made is for the nightly build/Struts 1.2. ActionError isn't marked as deprecated in 1.1. Are you talking about the ActionForm.validate() method? For the nightly build, yes, that looks about right. The html:errors/ tag in the nightly build doesn't even reference ActionError/s in the code -- it works with ActionMessage/s objects. I'm guessing they can't deprecate ActionErrors yet because it's in validate()'s signature. For errors in your Action class, try Wendy's suggestion. Wendy, are you using that code with 1.1? I haven't tried it yet. Now that I think about it, I'll start asking my teammates to start using these in Action classes. If it works, then better to write new Action classes that way than to add more soon-to-be-deprecated code. --- Slattery, Tim - BLS [EMAIL PROTECTED] wrote: Yes, we're supposed to use ActionMessage and ActionMessages now. The one place where we can't escape ActionError/s yet is ActionForm's validate method. Wait a minute!!! ActionError is marked as deprecated, but not ActionErrors. It looks to me like we create an ActionMessage, add that to an ActionErrors collection, and use html:errors/ to display the contents of that on the JSP page. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
It's the new and improved way to display messages on your pages. html:errors/ sometimes needed html markup on the message resources file to format the messages properly. The new html:messages tag gives the JSP full control over formatting, which is where it should be. --- Slattery, Tim - BLS [EMAIL PROTECTED] wrote: in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages Maybe I'm dumb, but I can't make any sense of this. Use it for what? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
From: Hubert Rabago [mailto:[EMAIL PROTECTED] Wendy, are you using that code with 1.1? I'm using a recent nightly build, so it's probably considered 1.2. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors deprecated?
..instead of the html:errors tag. The ActionError and ActionErrors classes are going away. Avoid creating more dependencies on them now (and thus more pain later) by using ActionMessage/ActionMessages instead. :-) Larry [EMAIL PROTECTED] 02/09/04 1:29 PM in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages Maybe I'm dumb, but I can't make any sense of this. Use it for what? -- Tim Slattery [EMAIL PROTECTED] - 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: ActionErrors deprecated?
hi, i use in in my form.jsp to enter foo-property of my formBean and the messages-tags to display error-messages, that came up during validation. //INPUT FOO: html:text property=foo/ //DISPLAY ERRORS-MSG struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages i add an ActionMessage-object to the action.errors.collection cheers, -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 9:29 PM To: 'Struts Users Mailing List' Subject: RE: ActionErrors deprecated? in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages Maybe I'm dumb, but I can't make any sense of this. Use it for what? -- Tim Slattery [EMAIL PROTECTED] - 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: ActionErrors deprecated?
Can we expect to have struts 1.2 fully moved over to using solely html:messages? Including all the validate methods on actions etc? -David - Original Message - From: Hubert Rabago [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 09, 2004 1:32 PM Subject: RE: ActionErrors deprecated? It's the new and improved way to display messages on your pages. html:errors/ sometimes needed html markup on the message resources file to format the messages properly. The new html:messages tag gives the JSP full control over formatting, which is where it should be. --- Slattery, Tim - BLS [EMAIL PROTECTED] wrote: in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages Maybe I'm dumb, but I can't make any sense of this. Use it for what? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - 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: ActionErrors deprecated?
hi david, if you mean validation.framework, i think yes, they are using ActionMessages instead ActionErrors. http://jakarta.apache.org/struts/api/org/apache/struts/validator/FieldCh ecks.html ActionErrors is in 1.2 only used in validate():ActionErrors cheers,! -Original Message- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 9:41 PM To: Struts Users Mailing List Subject: Re: ActionErrors deprecated? Can we expect to have struts 1.2 fully moved over to using solely html:messages? Including all the validate methods on actions etc? -David - Original Message - From: Hubert Rabago [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 09, 2004 1:32 PM Subject: RE: ActionErrors deprecated? It's the new and improved way to display messages on your pages. html:errors/ sometimes needed html markup on the message resources file to format the messages properly. The new html:messages tag gives the JSP full control over formatting, which is where it should be. --- Slattery, Tim - BLS [EMAIL PROTECTED] wrote: in jsp use this: html:text property=foo/ struts-html:messages id=error property=foo struts-bean:write name=error/ /struts-html:messages Maybe I'm dumb, but I can't make any sense of this. Use it for what? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: redirect=true ActionErrors
Hi Hubert, It would be nice if I get those subclasses to add to my app. Please point me to location of the patches. Also a write up for usage of those classes. Thanks Manjunath -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 10:29 PM To: Struts Users Mailing List Subject: RE: redirect=true ActionErrors Manjunath, The patch was just submitted and Ted Husted indicated he will look at it, but just because someone submits a patch doesn't mean it gets committed (I would hope not!). If it doesn't and you still need it, I can help you add some subclasses to your project to make it work for you. - Hubert --- Manjunath Bhat [EMAIL PROTECTED] wrote: Hi Thanks for the reply. My first concerns is with the action errors display on the web page, which is lost due to redirect=true, since it is bound to the request. I looked into transaction token, but its does not solve error display. I am thinking of using it somewhere else in my app. Thanks for the info I was going through the link provided by you, where the patch for ActionForward is being addressed. Please let me know which build of struts should I use to check the new implementation. Manjunath/ -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:33 PM To: Struts Users Mailing List Subject: Re: redirect=true ActionErrors There's no built-in support for this in the current version of Struts. I'm currently working on a patch which would support this (http://issues.apache.org/bugzilla/show_bug.cgi?id=866), but of course there's no guarantee that the patch (or something like it) will make it to a struts release. In the meantime, you may want to look into using struts' transaction tokens to allow you to detect double submissions when the user clicks refresh. If you're aching for this enhancement for your app, let me know and I'll send you some Struts subclasses that you can incorporate in your current project. (It's 2 AM my time, though, so I may not get back to you right away.) - Hubert --- Manjunath Bhat [EMAIL PROTECTED] wrote: The errors that I populated in ActionErrors in my action classes are not displayed in page if I use redirect=true. I am using redirect=true to handle user clicking refresh button. If I use redirect=false the ActionErrors are displayed. But I don't want to use redirect=false. Is there any work around for this problem? TIA Majnunath __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - 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: redirect=true ActionErrors
Hi Thanks for the reply. My first concerns is with the action errors display on the web page, which is lost due to redirect=true, since it is bound to the request. I looked into transaction token, but its does not solve error display. I am thinking of using it somewhere else in my app. Thanks for the info I was going through the link provided by you, where the patch for ActionForward is being addressed. Please let me know which build of struts should I use to check the new implementation. Thanks Regards Manjunath -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:33 PM To: Struts Users Mailing List Subject: Re: redirect=true ActionErrors There's no built-in support for this in the current version of Struts. I'm currently working on a patch which would support this (http://issues.apache.org/bugzilla/show_bug.cgi?id=866), but of course there's no guarantee that the patch (or something like it) will make it to a struts release. In the meantime, you may want to look into using struts' transaction tokens to allow you to detect double submissions when the user clicks refresh. If you're aching for this enhancement for your app, let me know and I'll send you some Struts subclasses that you can incorporate in your current project. (It's 2 AM my time, though, so I may not get back to you right away.) - Hubert --- Manjunath Bhat [EMAIL PROTECTED] wrote: The errors that I populated in ActionErrors in my action classes are not displayed in page if I use redirect=true. I am using redirect=true to handle user clicking refresh button. If I use redirect=false the ActionErrors are displayed. But I don't want to use redirect=false. Is there any work around for this problem? TIA Majnunath - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - 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: redirect=true ActionErrors
Hi Thanks for the reply. My first concerns is with the action errors display on the web page, which is lost due to redirect=true, since it is bound to the request. I looked into transaction token, but its does not solve error display. I am thinking of using it somewhere else in my app. Thanks for the info I was going through the link provided by you, where the patch for ActionForward is being addressed. Please let me know which build of struts should I use to check the new implementation. Manjunath/ -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:33 PM To: Struts Users Mailing List Subject: Re: redirect=true ActionErrors There's no built-in support for this in the current version of Struts. I'm currently working on a patch which would support this (http://issues.apache.org/bugzilla/show_bug.cgi?id=866), but of course there's no guarantee that the patch (or something like it) will make it to a struts release. In the meantime, you may want to look into using struts' transaction tokens to allow you to detect double submissions when the user clicks refresh. If you're aching for this enhancement for your app, let me know and I'll send you some Struts subclasses that you can incorporate in your current project. (It's 2 AM my time, though, so I may not get back to you right away.) - Hubert --- Manjunath Bhat [EMAIL PROTECTED] wrote: The errors that I populated in ActionErrors in my action classes are not displayed in page if I use redirect=true. I am using redirect=true to handle user clicking refresh button. If I use redirect=false the ActionErrors are displayed. But I don't want to use redirect=false. Is there any work around for this problem? TIA Majnunath - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - 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: redirect=true ActionErrors
Manjunath, The patch was just submitted and Ted Husted indicated he will look at it, but just because someone submits a patch doesn't mean it gets committed (I would hope not!). If it doesn't and you still need it, I can help you add some subclasses to your project to make it work for you. - Hubert --- Manjunath Bhat [EMAIL PROTECTED] wrote: Hi Thanks for the reply. My first concerns is with the action errors display on the web page, which is lost due to redirect=true, since it is bound to the request. I looked into transaction token, but its does not solve error display. I am thinking of using it somewhere else in my app. Thanks for the info I was going through the link provided by you, where the patch for ActionForward is being addressed. Please let me know which build of struts should I use to check the new implementation. Manjunath/ -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:33 PM To: Struts Users Mailing List Subject: Re: redirect=true ActionErrors There's no built-in support for this in the current version of Struts. I'm currently working on a patch which would support this (http://issues.apache.org/bugzilla/show_bug.cgi?id=866), but of course there's no guarantee that the patch (or something like it) will make it to a struts release. In the meantime, you may want to look into using struts' transaction tokens to allow you to detect double submissions when the user clicks refresh. If you're aching for this enhancement for your app, let me know and I'll send you some Struts subclasses that you can incorporate in your current project. (It's 2 AM my time, though, so I may not get back to you right away.) - Hubert --- Manjunath Bhat [EMAIL PROTECTED] wrote: The errors that I populated in ActionErrors in my action classes are not displayed in page if I use redirect=true. I am using redirect=true to handle user clicking refresh button. If I use redirect=false the ActionErrors are displayed. But I don't want to use redirect=false. Is there any work around for this problem? TIA Majnunath __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AUTO {ICICICARE#005-210-569}redirect=true ActionErrors
Dear Sir / Madam,Thank you for writing to [EMAIL PROTECTED] We confirm receipt of your mail and assure you of a response shortly.To help us serve you better, we would request you to kindly mention your account number or any reference number you may have in your future correspondence. Kindly visit our website www.icicibank.com\nri to know more on our products and services. With regards,Customer Care ICICI Bank Limited This communication being sent by ICICI Bank Ltd. is privileged and confidential, and is directed to and for the use of the addressee only. If this message reaches anyone other than the intended recipient, we request the reader not to reproduce, copy, disseminate or in any manner distribute it. We further request such recipient to notify us immediately by return email and delete the original message. ICICI Bank Ltd. does not guarantee the security of any information transmitted electronically and is not liable for the proper, timely and complete transmission thereof. Before opening any attachments please check them for viruses and defects.
Re: redirect=true ActionErrors
There's no built-in support for this in the current version of Struts. I'm currently working on a patch which would support this (http://issues.apache.org/bugzilla/show_bug.cgi?id=866), but of course there's no guarantee that the patch (or something like it) will make it to a struts release. In the meantime, you may want to look into using struts' transaction tokens to allow you to detect double submissions when the user clicks refresh. If you're aching for this enhancement for your app, let me know and I'll send you some Struts subclasses that you can incorporate in your current project. (It's 2 AM my time, though, so I may not get back to you right away.) - Hubert --- Manjunath Bhat [EMAIL PROTECTED] wrote: The errors that I populated in ActionErrors in my action classes are not displayed in page if I use redirect=true. I am using redirect=true to handle user clicking refresh button. If I use redirect=false the ActionErrors are displayed. But I don't want to use redirect=false. Is there any work around for this problem? TIA Majnunath - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AUTO {ICICICARE#005-212-999}redirect=true ActionErrors
Dear Sir / Madam,Thank you for writing to [EMAIL PROTECTED] We confirm receipt of your mail and assure you of a response shortly.To help us serve you better, we would request you to kindly mention your account number or any reference number you may have in your future correspondence. Kindly visit our website www.icicibank.com\nri to know more on our products and services. With regards,Customer Care ICICI Bank Limited This communication being sent by ICICI Bank Ltd. is privileged and confidential, and is directed to and for the use of the addressee only. If this message reaches anyone other than the intended recipient, we request the reader not to reproduce, copy, disseminate or in any manner distribute it. We further request such recipient to notify us immediately by return email and delete the original message. ICICI Bank Ltd. does not guarantee the security of any information transmitted electronically and is not liable for the proper, timely and complete transmission thereof. Before opening any attachments please check them for viruses and defects.
redirect=true ActionErrors
The errors that I populated in ActionErrors in my action classes are not displayed in page if I use redirect=true. I am using redirect=true to handle user clicking refresh button. If I use redirect=false the ActionErrors are displayed. But I don't want to use redirect=false. Is there any work around for this problem? TIA Majnunath - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionErrors display
Hi, I have been trying to work through the display of ActionErrors - both global and non-global (field level) - such that it would look something like the following HTML sample: html headtitleSearch Form/title/head body PstrongThe following errors have occurred:/strong/P UL LIiA global error has been detected/i/LI LIiLast Name is invalid./i/LI /UL pFields marked with a red background and a img src=https://scgi.ebay.com/saw/pics/sitewide/warning_9x10.gif; width=9 height=10 hspace=3 vspace=2 border=0font face=Arial, Helvetica, Verdana, sans-serif size=2 have failed validation./p form name=search method=POST action=search.do h3Please provide the following search criteria information./h3 pYou must complete all of the fields marked with an asterisk font color=red(*)/font./p pfont color=red*/fontLast Name: input style=background: red type=text name=lastname maxlength=25 size=25 value=Do! title=Last Name is invalid. img src=https://scgi.ebay.com/saw/pics/sitewide/warning_9x10.gif; width=9 height=10 hspace=3 vspace=2 border=0/p pfont color=red*/fontFirst Name: input type=text name=firstname maxlength=25 size=25 value=John/p input type=submit value=Continue /body /html The desire is: 1. All errors will appear in one place - the top of the page. 2. Any field for which validation errors have been detected, would be further flagged in 1 of three potential ways: a. changing the fields background colour; b. marking it with an exclamation icon (thanks to eBay for the quick sample); or c. including the error message (in this case Last Name is invalid.) in the title attribute of the input. #1 is easily achieved; however, I have been struggling with #2 in any form. The html:errors tag makes it very easy to output the message for a specific field, but I cannot seem to find a means to use it to flag that an error has occurred. Any suggestions would be greatly appreciated. Cheers, James THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors display
Looking at the source for the ErrorsTag, it definitely is designed only to output error messages. It seems you could pretty easily subclass ErrorsTag with a tag that uses the presence or absence of an error message for the given property to decide whether to return Tag.SKIP_BODY or Tag.EVAL_BODY_INCLUDE from doStartTag. Then your warning image HTML could be nested inside your jamesBrown:errorsPresent tag. You'll have to decide whether this feature is worth that effort, but there it is. -john. Brown, James wrote: The desire is: 1. All errors will appear in one place - the top of the page. 2. Any field for which validation errors have been detected, would be further flagged in 1 of three potential ways: a. changing the fields background colour; b. marking it with an exclamation icon (thanks to eBay for the quick sample); or c. including the error message (in this case Last Name is invalid.) in the title attribute of the input. #1 is easily achieved; however, I have been struggling with #2 in any form. The html:errors tag makes it very easy to output the message for a specific field, but I cannot seem to find a means to use it to flag that an error has occurred. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors display
check out logic:messagesPresent, it will do what you want for line item 2. There is a good example of using this in the book Professional Struts. I know... I wrote that example ;) Rick Hightower Developer Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm Struts/J2EE consulting -- http://www.arc-mind.com/consulting.htm#StrutsMentoring -Original Message- From: Brown, James [mailto:[EMAIL PROTECTED] Sent: Sunday, January 25, 2004 4:33 AM To: Struts Users Mailing List (E-mail) Subject: ActionErrors display Hi, I have been trying to work through the display of ActionErrors - both global and non-global (field level) - such that it would look something like the following HTML sample: html headtitleSearch Form/title/head body PstrongThe following errors have occurred:/strong/P UL LIiA global error has been detected/i/LI LIiLast Name is invalid./i/LI /UL pFields marked with a red background and a img src=https://scgi.ebay.com/saw/pics/sitewide/warning_9x10.gif; width=9 height=10 hspace=3 vspace=2 border=0font face=Arial, Helvetica, Verdana, sans-serif size=2 have failed validation./p form name=search method=POST action=search.do h3Please provide the following search criteria information./h3 pYou must complete all of the fields marked with an asterisk font color=red(*)/font./p pfont color=red*/fontLast Name: input style=background: red type=text name=lastname maxlength=25 size=25 value=Do! title=Last Name is invalid. img src=https://scgi.ebay.com/saw/pics/sitewide/warning_9x10.gif; width=9 height=10 hspace=3 vspace=2 border=0/p pfont color=red*/fontFirst Name: input type=text name=firstname maxlength=25 size=25 value=John/p input type=submit value=Continue /body /html The desire is: 1. All errors will appear in one place - the top of the page. 2. Any field for which validation errors have been detected, would be further flagged in 1 of three potential ways: a. changing the fields background colour; b. marking it with an exclamation icon (thanks to eBay for the quick sample); or c. including the error message (in this case Last Name is invalid.) in the title attribute of the input. #1 is easily achieved; however, I have been struggling with #2 in any form. The html:errors tag makes it very easy to output the message for a specific field, but I cannot seem to find a means to use it to flag that an error has occurred. Any suggestions would be greatly appreciated. Cheers, James THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - 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]
Where are my ActionErrors ?
Hello all, i have a problem when i'm trying to retrieve my ActionErrors in a JSP: In my Action i do the following: ... ActionErrors errors = new ActionErrors(); errors.add( INFORMATION, new ActionError( product.message.test ) ); saveErrors( request, errors ); ... In the forwarded JSP i try to request the ActionErrors: html:errors property=INFORMATION bundle=product.messages/ ... nut no Error is displayed. Even ActionErrors errors = (ActionErrors) request.getAttribute( org.apache.struts.Globals.ERROR_KEY ); ... delivers null. Where are my ActionErrors ? Thanks in advance, mario - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Where are my ActionErrors ?
Did you do a redirecting or non-redirecting forward to the JSP? -Original Message- From: Gleichmann, Mario [mailto:[EMAIL PROTECTED] Sent: Thursday, 15 January 2004 18:44 To: 'Struts Users Mailing List' Subject: Where are my ActionErrors ? Hello all, i have a problem when i'm trying to retrieve my ActionErrors in a JSP: In my Action i do the following: ... ActionErrors errors = new ActionErrors(); errors.add( INFORMATION, new ActionError( product.message.test ) ); saveErrors( request, errors ); ... In the forwarded JSP i try to request the ActionErrors: html:errors property=INFORMATION bundle=product.messages/ ... nut no Error is displayed. Even ActionErrors errors = (ActionErrors) request.getAttribute( org.apache.struts.Globals.ERROR_KEY ); ... delivers null. Where are my ActionErrors ? Thanks in advance, mario - 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]
AW: Where are my ActionErrors ?
Thanks, this should be the solution, since the request-object is a new one if using a redirect (gosh) ... ;o) Will take a look at my struts-config ... Thanks and regards, mario -Ursprüngliche Nachricht- Von: Andrew Hill [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 15. Januar 2004 11:44 An: Struts Users Mailing List Betreff: RE: Where are my ActionErrors ? Did you do a redirecting or non-redirecting forward to the JSP? -Original Message- From: Gleichmann, Mario [mailto:[EMAIL PROTECTED] Sent: Thursday, 15 January 2004 18:44 To: 'Struts Users Mailing List' Subject: Where are my ActionErrors ? Hello all, i have a problem when i'm trying to retrieve my ActionErrors in a JSP: In my Action i do the following: ... ActionErrors errors = new ActionErrors(); errors.add( INFORMATION, new ActionError( product.message.test ) ); saveErrors( request, errors ); ... In the forwarded JSP i try to request the ActionErrors: html:errors property=INFORMATION bundle=product.messages/ ... nut no Error is displayed. Even ActionErrors errors = (ActionErrors) request.getAttribute( org.apache.struts.Globals.ERROR_KEY ); ... delivers null. Where are my ActionErrors ? Thanks in advance, mario - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ConcurrentModificationException on ActionErrors
I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ConcurrentModificationException on ActionErrors
I don't know what is causing the exact error from your code snippet, but a ConcurrentModificationException is thrown when you try to modify a list on which you have an iterator. See here: http://java.sun.com/j2se/1.4.1/docs/api/java/util/ConcurrentModificationException.html Paul Global Equity Derivatives Technology Deutsche Bank [/] Office +44 (0)20 754 55458 Mobile +44 (0)7736 299483 Fax +44 (0)20 7547 2752 Richard Mixon (qwest) To: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED]cc: iz Subject: ConcurrentModificationException on ActionErrors 31/12/2003 15:36 Please respond to Struts Users Mailing List I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ConcurrentModificationException on ActionErrors
Paul, Thanks I had seen the exception javadoc. An in one of my subordinate methods I do have a logging snippet that uses an Iterator to display ALL of the contents of the ActionErrors. And I imagine that my subsequent use of the ActionErrors.add(ActionErrors) method also uses an Iterator to enumerate the ActionError objects. Is there anyway to close the first Iterator so that it does not cause this conflict? Thanks again - Richard -Original Message- From: Paul-J Woodward [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 8:51 AM To: Struts Users Mailing List Subject: Re: ConcurrentModificationException on ActionErrors I don't know what is causing the exact error from your code snippet, but a ConcurrentModificationException is thrown when you try to modify a list on which you have an iterator. See here: http://java.sun.com/j2se/1.4.1/docs/api/java/util/ConcurrentModificationException.html Paul Global Equity Derivatives Technology Deutsche Bank [/] Office +44 (0)20 754 55458 Mobile +44 (0)7736 299483 Fax +44 (0)20 7547 2752 Richard Mixon (qwest) To: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED]cc: iz Subject: ConcurrentModificationException on ActionErrors 31/12/2003 15:36 Please respond to Struts Users Mailing List I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - 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: ConcurrentModificationException on ActionErrors
It almost sounds like your code isn't handling errors1 and/or errors2 in a thread-safe manner. ConcurrentModificationException will be thrown if one thread is in the proces of iterating over a collection and another thread modifies that collection. ActionMessages.add(ActionMessages) will iterate over both the arg's properties and the messages for each property, so there's certainly the potential for the error you're seeing. Can you provide some more detail on how your code is organized? BTW, not sure if it's a c/p error, but you've got: if (!errors2.isEmpty()) { errors.add(errors1); // shouldn't that be errors2? } Quoting Richard Mixon (qwest) [EMAIL PROTECTED]: I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ConcurrentModificationException on ActionErrors
Could you show the implementation(s) of your ObjX.getErrors() methods. I'm guessing there's probably a better way to do what you're trying to do. It probably has something to do with the implementation of: http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionMessages.html#add(org.apache.struts.action.ActionMessages) which calls: http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionMessages.html#properties() which returns an Iterator, which, as described below probably throws your exception. It sounds like the ActionErrors instance you're adding may be the same one you're trying to add it to. -Ben From: Paul-J Woodward [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: ConcurrentModificationException on ActionErrors Date: Wed, 31 Dec 2003 15:51:01 + I don't know what is causing the exact error from your code snippet, but a ConcurrentModificationException is thrown when you try to modify a list on which you have an iterator. See here: http://java.sun.com/j2se/1.4.1/docs/api/java/util/ConcurrentModificationException.html Paul Global Equity Derivatives Technology Deutsche Bank [/] Office +44 (0)20 754 55458 Mobile +44 (0)7736 299483 Fax +44 (0)20 7547 2752 Richard Mixon (qwest) To: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED]cc: iz Subject: ConcurrentModificationException on ActionErrors 31/12/2003 15:36 Please respond to Struts Users Mailing List I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Working moms: Find helpful tips here on managing kids, home, work and yourself. http://special.msn.com/msnbc/workingmom.armx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ConcurrentModificationException on ActionErrors
Ben, The implementation is a pretty simple getter. The ActionErrors object is built by the call to obj1.method1(). /** * Get ActionErrors object */ public ActionErrors getErrors() { return errors; } The actual code for obj1 is very large (1900 lines) and of course 99% is not relevant to the issue (but which 1% is :) ) so I hesitate to attach it. The obj1 and obj2 objects (not their actual names) are actually DAO objects that take as input a Struts form bean and update and add/chg/delete the corresponding database object. All of the edit, error and mapping code is included (generated by XDoclet) so its huge (actually compiles small, but being generated its quite verbose). If I cannot figure this out, I will go back to a simpler strategy. I had weanted to let the user see all errors at once, rather than showing them some, having them correct them and then showing them more. Thanks again - Richard -Original Message- From: Ben Anderson [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 9:04 AM To: [EMAIL PROTECTED] Subject: Re: ConcurrentModificationException on ActionErrors Could you show the implementation(s) of your ObjX.getErrors() methods. I'm guessing there's probably a better way to do what you're trying to do. It probably has something to do with the implementation of: http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionMessages.html#add(org.apache.struts.action.ActionMessages) which calls: http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionMessages.html#properties() which returns an Iterator, which, as described below probably throws your exception. It sounds like the ActionErrors instance you're adding may be the same one you're trying to add it to. -Ben From: Paul-J Woodward [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: ConcurrentModificationException on ActionErrors Date: Wed, 31 Dec 2003 15:51:01 + I don't know what is causing the exact error from your code snippet, but a ConcurrentModificationException is thrown when you try to modify a list on which you have an iterator. See here: http://java.sun.com/j2se/1.4.1/docs/api/java/util/ConcurrentModificationException.html Paul Global Equity Derivatives Technology Deutsche Bank [/] Office +44 (0)20 754 55458 Mobile +44 (0)7736 299483 Fax +44 (0)20 7547 2752 Richard Mixon (qwest) To: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED]cc: iz Subject: ConcurrentModificationException on ActionErrors 31/12/2003 15:36 Please respond to Struts Users Mailing List I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Working moms: Find helpful tips here on managing kids, home, work and yourself. http://special.msn.com/msnbc/workingmom.armx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: ConcurrentModificationException on ActionErrors
Kris, Thanks - I do not think I have multiple threads involved, but certaily multiple Iterators may be hanging around that are not GC'd yet. And yes that was a typo. Because the real code is so huge, I created a simple example to paste in and obviously did not compile it :) - Richard -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 9:01 AM To: Struts Users Mailing List Subject: Re: ConcurrentModificationException on ActionErrors It almost sounds like your code isn't handling errors1 and/or errors2 in a thread-safe manner. ConcurrentModificationException will be thrown if one thread is in the proces of iterating over a collection and another thread modifies that collection. ActionMessages.add(ActionMessages) will iterate over both the arg's properties and the messages for each property, so there's certainly the potential for the error you're seeing. Can you provide some more detail on how your code is organized? BTW, not sure if it's a c/p error, but you've got: if (!errors2.isEmpty()) { errors.add(errors1); // shouldn't that be errors2? } Quoting Richard Mixon (qwest) [EMAIL PROTECTED]: I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - 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: ConcurrentModificationException on ActionErrors
Although it's possible to generate that exception from within the same thread, it's usually triggered by multiple threads accessing the same collection. In general, if you grab an iterator, then modify the underlying collection, and then call iter.next(), you'll see that exception. Having multiple iterators shouldn't be an issue - you don't explicitly close an iterator like a database connection. It will be GC-ed just like any other object. The problem really boils down to modifying the backing collection while iteration is in progress. By in progress, I mean doing something like calling iter.next(), not that there's just an iterator instance lying around. Quoting Richard Mixon (qwest) [EMAIL PROTECTED]: Kris, Thanks - I do not think I have multiple threads involved, but certaily multiple Iterators may be hanging around that are not GC'd yet. And yes that was a typo. Because the real code is so huge, I created a simple example to paste in and obviously did not compile it :) - Richard -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 9:01 AM To: Struts Users Mailing List Subject: Re: ConcurrentModificationException on ActionErrors It almost sounds like your code isn't handling errors1 and/or errors2 in a thread-safe manner. ConcurrentModificationException will be thrown if one thread is in the proces of iterating over a collection and another thread modifies that collection. ActionMessages.add(ActionMessages) will iterate over both the arg's properties and the messages for each property, so there's certainly the potential for the error you're seeing. Can you provide some more detail on how your code is organized? BTW, not sure if it's a c/p error, but you've got: if (!errors2.isEmpty()) { errors.add(errors1); // shouldn't that be errors2? } Quoting Richard Mixon (qwest) [EMAIL PROTECTED]: I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The code looks like: ... ActionErrors errors = new ActionErrors(); ActionErrors errors1 = null; ActionErrors errors2 = null; Obj1 obj1 = new Obj1(); Obj2 obj2 = new Obj2(); obj1.method1(); errors1 = obj1.getErrors(); if (!errors1.isEmpty()) { errors.add(errors1); } obj2.method2(); errors2 = obj2.getErrors(); if (!errors2.isEmpty()) { errors.add(errors1); } ... Problem is I get the ConcurrentModificationException when I try and do either of the errors.add methods above. Methods method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors. I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve ActionErrors. Any ideas or help is appreciated. - Richard -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with adding ActionMessage to ActionErrors
I noticed in the documentation that ActionError is deprecated, so I was trying to be a good doobie and use ActionMessage like the docs say to. So in my code, when I go from this: errors.add( ActionErrors.GLOBAL_ERROR, new ActionMessage( error.password.mismatch )); to this: errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( error.password.mismatch )); when my page tries to resolve html:errors/ I get: java.lang.ClassCastException at org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215)... Has anyone seen this? I'm using JBoss 3.2.2 (which uses Tomcat 4.1). Brad Ayers Senior Programmer Analyst Granite State Management and Resources [EMAIL PROTECTED] 603-225-5867 ext. 308 603-224-2581 Fax number CONFIDENTIALITY NOTICE This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with adding ActionMessage to ActionErrors
On 12/17/2003 09:36 PMnbsp;Bradford M. Ayers wrote: I noticed in the documentation that ActionError is deprecated, so I was trying to be a good doobie and use ActionMessage like the docs say to. So in my code, when I go from this: errors.add( ActionErrors.GLOBAL_ERROR, new ActionMessage( error.password.mismatch )); to this: errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( error.password.mismatch )); when my page tries to resolve html:errors/ I get: java.lang.ClassCastException at org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215)... Has anyone seen this? I'm using JBoss 3.2.2 (which uses Tomcat 4.1). Hi Bradford, I think the ErrorsTag is expecting an ActionErrors collection and you are giving it an ActionMessages. Is that so? I could be wrong but this is an area that I only managed to understand for about 30 minutes while I implemented it, and then I forgot it immediately. :O Adam -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors without resource bundle.
It worked. Thanks. rgds Antony Paul. - Original Message - From: Ted Husted [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 11:17 PM Subject: Re: ActionErrors without resource bundle. You can put a single entry in the bundle general.error={0} and use this with all your error messages. HTH, Ted. Antony Paul wrote: Hi, I want to display error messages saved in Action class using saveErrors without looking at resource bundle. Instead of the key provide message. Possible ? Our app does not need internatilisation support and putting all errors related to business logic in resource bundle is unnecessary. There will be lot of entries int it. One have to use searching tools to find the error message in bundle. rgds Antony Paul - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionErrors without resource bundle.
Hi, I want to display error messages saved in Action class using saveErrors without looking at resource bundle. Instead of the key provide message. Possible ? Our app does not need internatilisation support and putting all errors related to business logic in resource bundle is unnecessary. There will be lot of entries int it. One have to use searching tools to find the error message in bundle. rgds Antony Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors without resource bundle.
You can put a single entry in the bundle general.error={0} and use this with all your error messages. HTH, Ted. Antony Paul wrote: Hi, I want to display error messages saved in Action class using saveErrors without looking at resource bundle. Instead of the key provide message. Possible ? Our app does not need internatilisation support and putting all errors related to business logic in resource bundle is unnecessary. There will be lot of entries int it. One have to use searching tools to find the error message in bundle. rgds Antony Paul - 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: ActionErrors without resource bundle.
Hi, I don't think it's possible. I've been looking at issues with ActionErrors and ActionMessages and I could not find any constructors that wuld let you pass a message String rather than a key to use in a resource bundle. I have the problem where I an using more than one file with resources. To do this I've had to have multiple html:message tags in the web documents. I've been getting the impression over the last few months that there are a number of areas in struts that have only been coded with the minimal functionality as assumed by developers who wish to do things in a certain way. I.e. if you want to do things slightly differently you either can't or you will have to write your own JSP tags to do it. I would suggest that if you really need to do this, then write your own JSP tag to replace html:errors. I would probably make it look for a LinkedList of text strings or something in a bean and display them. Then you could populate this list in any fashion you liked. If you haven't written a tag before it's not difficult to do once you understand the bits you need. cio Derek. On Thursday 11 December 2003 01:19, Antony Paul wrote: Hi, I want to display error messages saved in Action class using saveErrors without looking at resource bundle. Instead of the key provide message. Possible ? Our app does not need internatilisation support and putting all errors related to business logic in resource bundle is unnecessary. There will be lot of entries int it. One have to use searching tools to find the error message in bundle. rgds Antony Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Regards, Derek Clarkson .O. Analyst/Programmer ..O Waterwerks Pty Ltd OOO Melbourne, Australia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
No getProperties() on ActionErrors?
Hi all, I have the following problem: I want to access ActionError objects using the EL language in a JSP page like this (for a reason I don't want to work with the html:error taglib): c:forEach items=${requestScope}['org.apache.struts.action.ERROR'].properties var=error divc:out value=${error}//div /c:forEach My guess is that this doesn't work because the ActionErrors class has a properties() method and not a getProperties() method. Does anyone know a way to iterate over the ActionError objects in the ActionError object using the EL language? Thanks and regards, Jeroen Breedveld - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session Scope ActionForm, ActionErrors and the Back Button
My application has a sequence of pages that submit to a single ActionForm with session scope. The problem I have is that if the user clicks the Back button any previous ActionErrors are still displayed, even though the form fields may be populated with valid values. Is it possible to specify a session scope ActionForm with request scope ActionErrors? How can I solve this problem? I really want to keep the ActionForm in the session. I've searched this list but didn't find any solutions. Thanks in anticipation, John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session Scope ActionForm, ActionErrors and the Back Button
On the controller element in the struts config, set the nocache attribute to true. We just did this for our current project and it has fixed a lot of issues with our wizard-type flows where we use a SessionBean to dictate flow. The other option is to manually write the pragma/expire headers on the action that displays the form to make sure that the particular page doesn't get cached by the client. We've found that having the JSP declare the no cache headers doesn't work too consistently (possibly web designer error). Action.execute(..) { response.setHeader(Pragma, No-cache); response.setHeader(Cache-Control, no-cache); response.setDateHeader(Expires, 1); return mapping.findForward(someval); } Jacob Hookom Senior Analyst/Programmer McKesson Medical-Surgical Golden Valley, Minnesota http://www.mckesson.com -Original Message- From: John Topley [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 12:31 PM To: [EMAIL PROTECTED] Subject: Session Scope ActionForm, ActionErrors and the Back Button My application has a sequence of pages that submit to a single ActionForm with session scope. The problem I have is that if the user clicks the Back button any previous ActionErrors are still displayed, even though the form fields may be populated with valid values. Is it possible to specify a session scope ActionForm with request scope ActionErrors? How can I solve this problem? I really want to keep the ActionForm in the session. I've searched this list but didn't find any solutions. Thanks in anticipation, John - 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: Session Scope ActionForm, ActionErrors and the Back Button
John, ActionErrors is stored under the key: Globals.ERROR_KEY. You can implement your ActionForm reset (which is called on all ActionForm objects on every request) method to remove the ActionErrors found under this key from your Request or Session. Jonathan -Original Message- From: John Topley [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 1:31 PM To: [EMAIL PROTECTED] Subject: Session Scope ActionForm, ActionErrors and the Back Button My application has a sequence of pages that submit to a single ActionForm with session scope. The problem I have is that if the user clicks the Back button any previous ActionErrors are still displayed, even though the form fields may be populated with valid values. Is it possible to specify a session scope ActionForm with request scope ActionErrors? How can I solve this problem? I really want to keep the ActionForm in the session. I've searched this list but didn't find any solutions. Thanks in anticipation, John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session Scope ActionForm, ActionErrors and the Back Button
Note that when you hit the Back button on a page not cached and retrieved by a GET, the browser will perform a new request... If the page was retrieved by a POST, the browser will display an error message or ask the user if he wants to repost the form. Hookom, Jacob [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On the controller element in the struts config, set the nocache attribute to true. We just did this for our current project and it has fixed a lot of issues with our wizard-type flows where we use a SessionBean to dictate flow. The other option is to manually write the pragma/expire headers on the action that displays the form to make sure that the particular page doesn't get cached by the client. We've found that having the JSP declare the no cache headers doesn't work too consistently (possibly web designer error). Action.execute(..) { response.setHeader(Pragma, No-cache); response.setHeader(Cache-Control, no-cache); response.setDateHeader(Expires, 1); return mapping.findForward(someval); } Jacob Hookom Senior Analyst/Programmer McKesson Medical-Surgical Golden Valley, Minnesota http://www.mckesson.com -Original Message- From: John Topley [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 12:31 PM To: [EMAIL PROTECTED] Subject: Session Scope ActionForm, ActionErrors and the Back Button My application has a sequence of pages that submit to a single ActionForm with session scope. The problem I have is that if the user clicks the Back button any previous ActionErrors are still displayed, even though the form fields may be populated with valid values. Is it possible to specify a session scope ActionForm with request scope ActionErrors? How can I solve this problem? I really want to keep the ActionForm in the session. I've searched this list but didn't find any solutions. Thanks in anticipation, John - 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]
ActionErrors problem...
I have this in my code: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.key.invalid-value.dummy,keyname,value,expected); I have this in application.properties: error.key.invalid-value.dummy=DUMMY: key:{0} Value:{1} expected:{2} However, using html:errors/ in my page, the only thing that gets displayed is: DUMMY: key: Value: expected: i.e. the replacement values I give are swallowed. Any idea on what I am doing wrong? I tried calling new ActionError(..,a) where a is an Object[] with the values I want. This did not work either. I imagine I must be missing something obvious... Thanks for any hint... D. -- Dominique de Waleffe Email: [EMAIL PROTECTED] [No HTML please] Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium Phone: +32 2 757 10 15 Fax: +32 2 759 27 60 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors problem...
This may be a copy/paste issue, but this shouldn't even compile as it looks here. You are missing a ) at the end. Dominique de Waleffe wrote: I have this in my code: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.key.invalid-value.dummy,keyname,value,expected); I have this in application.properties: error.key.invalid-value.dummy=DUMMY: key:{0} Value:{1} expected:{2} However, using html:errors/ in my page, the only thing that gets displayed is: DUMMY: key: Value: expected: i.e. the replacement values I give are swallowed. Any idea on what I am doing wrong? I tried calling new ActionError(..,a) where a is an Object[] with the values I want. This did not work either. I imagine I must be missing something obvious... Thanks for any hint... D. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors problem...
Brad Balmer wrote: This may be a copy/paste issue, but this shouldn't even compile as it looks here. You are missing a ) at the end. Cut-n-paste error. The code compiles. Only the replacements do not appear. When I put an extra placeholder {3} and give 3 args only, the {3} appears in the message. The {0} to {2} are swallowed... D. -- Dominique de Waleffe Email: [EMAIL PROTECTED] [No HTML please] Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium Phone: +32 2 757 10 15 Fax: +32 2 759 27 60 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors problem...
On 11/18/2003 07:29:41 AM Dominique de Waleffe wrote: I have this in my code: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.key.invalid-value.dummy,keyname,value,expected); Are keyname, value, expected evaluated or literal values? Do you mean to have the quotes around them? Can you print out the values in statements to make sure they are not blank values? Susan I have this in application.properties: error.key.invalid-value.dummy=DUMMY: key:{0} Value:{1} expected:{2} However, using html:errors/ in my page, the only thing that gets displayed is: DUMMY: key: Value: expected: i.e. the replacement values I give are swallowed. Any idea on what I am doing wrong? I tried calling new ActionError(..,a) where a is an Object[] with the values I want. This did not work either. I imagine I must be missing something obvious... Thanks for any hint... D. -- Dominique de Waleffe Email: [EMAIL PROTECTED] [No HTML please] Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium Phone: +32 2 757 10 15 Fax: +32 2 759 27 60 - 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: ActionErrors problem...
Susan Bradeen wrote: On 11/18/2003 07:29:41 AM Dominique de Waleffe wrote: I have this in my code: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.key.invalid-value.dummy,keyname,value,expected); Are keyname, value, expected evaluated or literal values? Do you mean to have the quotes around them? Can you print out the values in statements to make sure they are not blank values? They are just String values I want to be included in my message... This was just a test to see if the thing works, I expect: DUMMY: key:keyname Value:value expected:expected Of course in the rest of the code I have other strings to put D. -- Dominique de Waleffe Email: [EMAIL PROTECTED] [No HTML please] Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium Phone: +32 2 757 10 15 Fax: +32 2 759 27 60 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors problem...
I've just made a little test writing DUMMY: key:keyname Value:value expected:expected in an html document.. and i got DUMMY: key: Value: expected: the problem is that is a special html symbol explorer thinks its an unknown tag and outputs nothing. if you look in the HTML source of your document, i think you'll see what you were expecting. to output , use lt; hope it helps Caroline Caroline LAUFERON Cap Gemini Telecom Media Networks France Skill Center VASN - RENNES 02 99 27 61 92 [EMAIL PROTECTED] - Original Message - From: Dominique de Waleffe [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 1:29 PM Subject: ActionErrors problem... I have this in my code: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.key.invalid-value.dummy,keyname,value,expected ); I have this in application.properties: error.key.invalid-value.dummy=DUMMY: key:{0} Value:{1} expected:{2} However, using html:errors/ in my page, the only thing that gets displayed is: DUMMY: key: Value: expected: i.e. the replacement values I give are swallowed. Any idea on what I am doing wrong? I tried calling new ActionError(..,a) where a is an Object[] with the values I want. This did not work either. I imagine I must be missing something obvious... Thanks for any hint... D. -- Dominique de Waleffe Email: [EMAIL PROTECTED] [No HTML please] Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium Phone: +32 2 757 10 15 Fax: +32 2 759 27 60 - 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: ActionErrors problem...
Caroline Lauferon wrote: I've just made a little test writing DUMMY: key:keyname Value:value expected:expected in an html document.. and i got DUMMY: key: Value: expected: the problem is that is a special html symbol explorer thinks its an unknown tag and outputs nothing. if you look in the HTML source of your document, i think you'll see what you were expecting. to output , use lt; Of course. Completely missed that one... I was really looking for something else..l Thanks a lot, D. -- Dominique de Waleffe Email: [EMAIL PROTECTED] [No HTML please] Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium Phone: +32 2 757 10 15 Fax: +32 2 759 27 60 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionErrors are not displayed after page is refreshed.
Hi, I have a jsp in which i have written the following code to display the errors, logic:messagesPresent p CLASS=errorsHeader bean:message key=errors.validation.header/ /p html:messages id=error lic:out value=${error}//li /html:messages hr SIZE=1 NOSHADE WIDTH=620 ALIGN=left /logic:messagesPresent Along with that i have a code to at the bottom of page to go to top of the pages as follows, TD ALIGN=center COLSPAN=10A HREF=#tophtml:img page=/images/IcoGoTop.gif width=17 height=17 border=0 alt=Top of Page/html:img/A /TD Now the problem i am facing is that when i click on top image the page gets refreshed and errors messages goes off. Is there any way i can provide a code to goto top along with keeping the error messages. Thanks and Regards Deepak. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors are not displayed after page is refreshed.
Hi, I think the problem is that you define a new Event when going to top of your page. Try this: make a simple javascript, that sets the focus to an element at the top of the page (that leads the browser to go to the focused element and therefore to the top of the page), then your Error-Messages should remain. Regards Christine -Ursprüngliche Nachricht- Von: deepaksawdekar [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 06. November 2003 19:51 An: Struts Users Mailing List Betreff: ActionErrors are not displayed after page is refreshed. Hi, I have a jsp in which i have written the following code to display the errors, logic:messagesPresent p CLASS=errorsHeader bean:message key=errors.validation.header/ /p html:messages id=error lic:out value=${error}//li /html:messages hr SIZE=1 NOSHADE WIDTH=620 ALIGN=left /logic:messagesPresent Along with that i have a code to at the bottom of page to go to top of the pages as follows, TD ALIGN=center COLSPAN=10A HREF=#tophtml:img page=/images/IcoGoTop.gif width=17 height=17 border=0 alt=Top of Page/html:img/A /TD Now the problem i am facing is that when i click on top image the page gets refreshed and errors messages goes off. Is there any way i can provide a code to goto top along with keeping the error messages. Thanks and Regards Deepak. - 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]
ActionErrors configuration
Hi, I am trying to configure my app so that when some of the text fields are not populated, I show errors and redisplay the same page. The configuration I have is: action path=/systemDetails type=com.paycycle.profile.actions.SystemDetailsAction name=systemDetailForm scope=request input=/systemDetails . /action When I try to run the app with this configuration and there are errors, I get: The requested resource (/profile/systemDetails) is not available. Can you help me out here? Thanks, Ramesh.
Re: ActionErrors configuration
You should have the name of the jsp with the form (or possible the action that leads to the form page, with the .do extension) as the input. So your action would have input=/systemDetails.jsp if that is the name of your jsp page. Regards At 13:10 2003-11-03 -0800, you wrote: Hi, I am trying to configure my app so that when some of the text fields are not populated, I show errors and redisplay the same page. The configuration I have is: action path=/systemDetails type=com.paycycle.profile.actions.SystemDetailsAction name=systemDetailForm scope=request input=/systemDetails . /action When I try to run the app with this configuration and there are errors, I get: The requested resource (/profile/systemDetails) is not available. Can you help me out here? Thanks, Ramesh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors configuration
Hi, Turns out that even though the documentation says I should use ActionErrors.add(String, ActionMessage), using (String, ActionError) solved the problem! Any ideas why? Ramesh. -Original Message- From: Mikael Eriksson - Swedish Connection [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 1:11 PM To: Struts Users Mailing List Subject: Re: ActionErrors configuration You should have the name of the jsp with the form (or possible the action that leads to the form page, with the .do extension) as the input. So your action would have input=/systemDetails.jsp if that is the name of your jsp page. Regards At 13:10 2003-11-03 -0800, you wrote: Hi, I am trying to configure my app so that when some of the text fields are not populated, I show errors and redisplay the same page. The configuration I have is: action path=/systemDetails type=com.paycycle.profile.actions.SystemDetailsAction name=systemDetailForm scope=request input=/systemDetails . /action When I try to run the app with this configuration and there are errors, I get: The requested resource (/profile/systemDetails) is not available. Can you help me out here? Thanks, Ramesh. - 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: ActionErrors configuration
Hi That sound like another problem than what you wrote about first :-) But anyway ActionErrors has both an add(String, ActionMessage), defined in the superclass ActionMessages, and an add(String,ActionError) , defined in ActionErrors class which just calls the superclass version. That call works fine sinse ActionError inherits from ActionMessage. Regards At 13:28 2003-11-03 -0800, you wrote: Hi, Turns out that even though the documentation says I should use ActionErrors.add(String, ActionMessage), using (String, ActionError) solved the problem! Any ideas why? Ramesh. -Original Message- From: Mikael Eriksson - Swedish Connection [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 1:11 PM To: Struts Users Mailing List Subject: Re: ActionErrors configuration You should have the name of the jsp with the form (or possible the action that leads to the form page, with the .do extension) as the input. So your action would have input=/systemDetails.jsp if that is the name of your jsp page. Regards At 13:10 2003-11-03 -0800, you wrote: Hi, I am trying to configure my app so that when some of the text fields are not populated, I show errors and redisplay the same page. The configuration I have is: action path=/systemDetails type=com.paycycle.profile.actions.SystemDetailsAction name=systemDetailForm scope=request input=/systemDetails . /action When I try to run the app with this configuration and there are errors, I get: The requested resource (/profile/systemDetails) is not available. Can you help me out here? Thanks, Ramesh. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors configuration
Try this action path=/profile/systemDetails type=com.paycycle.profile.actions.SystemDetailsAction name=systemDetailForm scope=request input=/systemDetails Thanks Nazeer -Original Message- From: Ramesh Bobba [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 4:10 PM To: [EMAIL PROTECTED] Subject: ActionErrors configuration Hi, I am trying to configure my app so that when some of the text fields are not populated, I show errors and redisplay the same page. The configuration I have is: action path=/systemDetails type=com.paycycle.profile.actions.SystemDetailsAction name=systemDetailForm scope=request input=/systemDetails . /action When I try to run the app with this configuration and there are errors, I get: The requested resource (/profile/systemDetails) is not available. Can you help me out here? Thanks, Ramesh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
I tried your suggestion, and sad to say: it didn't work. I see that you're using EL - do I have to specify anything special in my jsp page to make it work? Apart from the usual taglibs. /Keld - Original Message - DATE: Mon, 27 Oct 2003 14:56:08 From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: On 10/27/2003 12:47 PM Keld Hansen wrote: Thanx, I'll try it, but I read your suggestion as this: write out all global messages in the ActionMessages queue so I'll be surpised to see the messages from the Validator. I'm just telling you what I'm doing :) - there's no reason why it shouldn't work for you. -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Enter for a chance to win one year's supply of allergy relief! http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982 This offer applies to U.S. Residents Only - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
On 10/28/2003 08:17 AM Keld Hansen wrote: I tried your suggestion, and sad to say: it didn't work. I see that you're using EL - do I have to specify anything special in my jsp page to make it work? Apart from the usual taglibs. /Keld - Original Message - DATE: Mon, 27 Oct 2003 14:56:08 From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: On 10/27/2003 12:47 PM Keld Hansen wrote: Thanx, I'll try it, but I read your suggestion as this: write out all global messages in the ActionMessages queue so I'll be surpised to see the messages from the Validator. I'm just telling you what I'm doing :) - there's no reason why it shouldn't work for you. OK so I was wrong, there is a reason why it shouldn't work for you :( I am using DynaValidator - but I can't imagine that it would cause this difference. Actually I've just discovered that there are pages in my app where the validator messages are not showing up - but there are pages, e.g. the one I checked yesterday before I answered your question, where the validator messages do turn up. I'll see what on earth is going on let you know. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
Great Adam, I really appreciate your info. BTW: I saw in the struts-dev newsgroup that there are some discussions about how to get rid of ActionErrors, and apparantly it's not crystal clear what will happen. Anyway I didn't find useful information about the Validator. I've given up experimenting, and must -- until new ideas pop up -- stick to the old ActionErrors class. [I don't like the name of the class--it's supposed to hold any type of message - right? :-) ] /Keld -- - Original Message - DATE: Tue, 28 Oct 2003 09:03:26 From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: On 10/28/2003 08:17 AM Keld Hansen wrote: I tried your suggestion, and sad to say: it didn't work. I see that you're using EL - do I have to specify anything special in my jsp page to make it work? Apart from the usual taglibs. /Keld - Original Message - DATE: Mon, 27 Oct 2003 14:56:08 From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: On 10/27/2003 12:47 PM Keld Hansen wrote: Thanx, I'll try it, but I read your suggestion as this: write out all global messages in the ActionMessages queue so I'll be surpised to see the messages from the Validator. I'm just telling you what I'm doing :) - there's no reason why it shouldn't work for you. OK so I was wrong, there is a reason why it shouldn't work for you :( I am using DynaValidator - but I can't imagine that it would cause this difference. Actually I've just discovered that there are pages in my app where the validator messages are not showing up - but there are pages, e.g. the one I checked yesterday before I answered your question, where the validator messages do turn up. I'll see what on earth is going on let you know. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Enter for a chance to win one year's supply of allergy relief! http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982 This offer applies to U.S. Residents Only - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
On 10/28/2003 10:16 AM Keld Hansen wrote: Great Adam, I really appreciate your info. BTW: I saw in the struts-dev newsgroup that there are some discussions about how to get rid of ActionErrors, and apparantly it's not crystal clear what will happen. Anyway I didn't find useful information about the Validator. I've given up experimenting, and must -- until new ideas pop up -- stick to the old ActionErrors class. [I don't like the name of the class--it's supposed to hold any type of message - right? :-) ] /Keld I am using DynaValidator - but I can't imagine that it would cause this difference. Actually I've just discovered that there are pages in my app where the validator messages are not showing up - but there are pages, e.g. the one I checked yesterday before I answered your question, where the validator messages do turn up. I'll see what on earth is going on let you know. Hi Keld, I just discovered that I was in fact not showing any of my validator errors. It just goes to show that having javascript validation enabled means I had assumed it was working fine for x weeks - but anyway, I worked out I needed this taglib to show them: html:messages id=validatorMsgs message=false header=errors.header footer=errors.footer c:out value=${validatorMsgs} / /html:messages Since I'm using Tiles though I only had to add this in one place and now it's fine again. (Guess I can turn javascript back on in my browser...) Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionErrors/ActionMessages
I'd like to emphasize the importance of a mail recently added to the newsgroup regarding the use of ActionErrors and/or ActionMessages. The Validator uses the ActionErrors queue, so even if you'd like to use the new ActionMessages queue you'd hesitate to do so since this forces you to manage two queues in your jsp-pages. So when ActionErrors(s) gets deprecated (in version 1.2?) then what do you do? I'd be very interested in an answer on this topic. Thanx. Enter for a chance to win one year's supply of allergy relief! http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982 This offer applies to U.S. Residents Only - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
On 10/27/2003 08:21 AM Keld Hansen wrote: I'd like to emphasize the importance of a mail recently added to the newsgroup regarding the use of ActionErrors and/or ActionMessages. The Validator uses the ActionErrors queue, so even if you'd like to use the new ActionMessages queue you'd hesitate to do so since this forces you to manage two queues in your jsp-pages. So when ActionErrors(s) gets deprecated (in version 1.2?) then what do you do? I'd be very interested in an answer on this topic. Thanx. I use the ActionMessages collection and not the ActionErrors, and I use the html:message/ taglib in my JSPs to display them. It works fine with the Validator. If I remember correctly, the html:errors/ taglib will throw an exception if you give it an ActionMessages collection to display, but other than that caveat, you should be OK. Regards Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
Let me elaborate a little: As I understand it the Validator uses the ActionErrors queue. This means that I'll have to code this in my jsp-page: html:messages id=error message=false BRbean:write name=error/ /html:messages If I use the ActionMessages queue for my own validation - or error handling in general - in my Action classes, then I'll also have to code this in my jsp-pages: html:messages id=error message=true BRbean:write name=error/ /html:messages So the net result is that my jps-pages becomes more clumsy. My question is really: is it possible to direct messages from the Validator to the ActionMessages queue? If not: how is it then possible to deprecate the ActionErrors queue? Enter for a chance to win one year's supply of allergy relief! http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982 This offer applies to U.S. Residents Only - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
On 10/27/2003 09:59 AM Keld Hansen wrote: Let me elaborate a little: As I understand it the Validator uses the ActionErrors queue. This means that I'll have to code this in my jsp-page: html:messages id=error message=false BRbean:write name=error/ /html:messages If I use the ActionMessages queue for my own validation - or error handling in general - in my Action classes, then I'll also have to code this in my jsp-pages: html:messages id=error message=true BRbean:write name=error/ /html:messages So the net result is that my jps-pages becomes more clumsy. My question is really: is it possible to direct messages from the Validator to the ActionMessages queue? If not: how is it then possible to deprecate the ActionErrors queue? This works to display the Validator messages and errors from the Actions if you save them like request.setAttribute(Globals.MESSAGE_KEY, messages) html:messages id=errorMsgs message=true property=${GLOBAL_ERROR} header=errors.header footer=errors.footer c:out value=${errorMsgs} / /html:messages I'm afraid I don't remember the finer details but this will show both yours and Validator's errors. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
Thanx, I'll try it, but I read your suggestion as this: write out all global messages in the ActionMessages queue so I'll be surpised to see the messages from the Validator. /keld - Original Message - This works to display the Validator messages and errors from the Actions if you save them like request.setAttribute(Globals.MESSAGE_KEY, messages) html:messages id=errorMsgs message=true property=${GLOBAL_ERROR} header=errors.header footer=errors.footer c:out value=${errorMsgs} / /html:messages I'm afraid I don't remember the finer details but this will show both yours and Validator's errors. Adam Enter for a chance to win one year's supply of allergy relief! http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982 This offer applies to U.S. Residents Only - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors/ActionMessages
On 10/27/2003 12:47 PM Keld Hansen wrote: Thanx, I'll try it, but I read your suggestion as this: write out all global messages in the ActionMessages queue so I'll be surpised to see the messages from the Validator. I'm just telling you what I'm doing :) - there's no reason why it shouldn't work for you. -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
errors and exception in ActionErrors
I would like to put in the ActionErrors object regular errors that may happen and also an exception without loosing the previously stored errors. These are the steps I am taking and the results I am getting: 1. Errors occur so I add them to the ActionErrors with the GLOBAL_ERROR property: ActionErrors myActionErrors = new ActionErrors(); myActionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(test.error)); myActionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(test.error2)); saveErrors(request, myActionErrors); 2. An exception is thrown: catch(Exception e) { throw new TestException(this was a test Exception,e); } 3. The exception is handle by the ExceptionHandler defined in the config file: !-- Test Exception Handdler -- action path=/test type=edu.miami.BaseAction exception type=edu.miami.exceptions.TestException key=test.exception path=/testExceptionError.jsp / forward name=success path=/testExceptionNoError.jsp / /action 4. When I try to output the information in the JSP using the errors tag only information about the exception is diplayed. test.error and test.error2 seems as if they were gone. html:errors / How can I keep both, errors and the exception in hte ActionErrors object, or how can I access them if they are there already? Also I would like to find out under which property is the exception information kept in the ActionErrors because when I try to output html:errors property=%=ActionErrors.GLOBAL_ERROR% / the exception information is not shown, so it must be under some other property. Thanks Jorge Luis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: errors and exception in ActionErrors
On 10/27/2003 03:03 PM Fiallega, Jorge wrote: I would like to put in the ActionErrors object regular errors that may happen and also an exception without loosing the previously stored errors. These are the steps I am taking and the results I am getting: 1. Errors occur so I add them to the ActionErrors with the GLOBAL_ERROR property: ActionErrors myActionErrors = new ActionErrors(); myActionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(test.error)); myActionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(test.error2)); saveErrors(request, myActionErrors); 2. An exception is thrown: catch(Exception e) { throw new TestException(this was a test Exception,e); } 3. The exception is handle by the ExceptionHandler defined in the config file: !-- Test Exception Handdler -- action path=/test type=edu.miami.BaseAction exception type=edu.miami.exceptions.TestException key=test.exception path=/testExceptionError.jsp / forward name=success path=/testExceptionNoError.jsp / /action 4. When I try to output the information in the JSP using the errors tag only information about the exception is diplayed. test.error and test.error2 seems as if they were gone. html:errors / How can I keep both, errors and the exception in hte ActionErrors object, or how can I access them if they are there already? Also I would like to find out under which property is the exception information kept in the ActionErrors because when I try to output html:errors property=%=ActionErrors.GLOBAL_ERROR% / the exception information is not shown, so it must be under some other property. Hi Jorge, I have no expert knowledge of the workings of ActionErrors struts controller, in fact until you mentioned it, I was unaware that you could map an exception to a JSP via the action mapping like that. However you could easily find out what happens to your exceptions by debugging in the JSP to see what is in there. Perhaps struts simply overwrites any object that is already stored in the request under that key. And the exceptions may be held in the collection under the ActionMessages.GLOBAL_MESSAGE property. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Deprecating ActionError/ActionErrors
--- Wendy Smoak [EMAIL PROTECTED] wrote: I don't know if this work is still ongoing, but I notice that ActionError and ActionErrors are deprecated, yet the validate method of DynaValidatorForm still returns an ActionErrors object. Only ActionError is deprecated right now. However, most of the references to ActionErrors in Struts have been replaced with ActionMessages. ActionErrors is still around because it's in the ActionForm.validate() method signature. Use ActionMessage and ActionMessages wherever possible for a Struts 1.2 app. Eventually, we'll use Commons Resources' Message and MessageList interfaces. David I looked at the validate method of DynaValidatorForm, and I'm confused. It doesn't seem to do what it says it does. AFAICT, this method *always* returns the empty ActionErrors object that's created with: ActionErrors errors = new ActionErrors(); If errors ARE found, they're never put into that ActionErrors object, they're stored in the protected ValidatorResults object. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return codeActionErrors/code object that encapsulates any validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { this.setPageFromDynaProperty(); ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); Validator validator = Resources.initValidator(mapping.getAttribute(), this, application, request, errors, page); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } Can someone who knows what's happening with ActionError/ActionErrors please post a summary? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Deprecating ActionError/ActionErrors
I don't know if this work is still ongoing, but I notice that ActionError and ActionErrors are deprecated, yet the validate method of DynaValidatorForm still returns an ActionErrors object. I looked at the validate method of DynaValidatorForm, and I'm confused. It doesn't seem to do what it says it does. AFAICT, this method *always* returns the empty ActionErrors object that's created with: ActionErrors errors = new ActionErrors(); If errors ARE found, they're never put into that ActionErrors object, they're stored in the protected ValidatorResults object. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return codeActionErrors/code object that encapsulates any validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { this.setPageFromDynaProperty(); ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); Validator validator = Resources.initValidator(mapping.getAttribute(), this, application, request, errors, page); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } Can someone who knows what's happening with ActionError/ActionErrors please post a summary? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Deprecating ActionError/ActionErrors
- Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 17, 2003 6:42 PM Subject: Deprecating ActionError/ActionErrors I don't know if this work is still ongoing, but I notice that ActionError and ActionErrors are deprecated, yet the validate method of DynaValidatorForm still returns an ActionErrors object. I looked at the validate method of DynaValidatorForm, and I'm confused. It doesn't seem to do what it says it does. AFAICT, this method *always* returns the empty ActionErrors object that's created with: ActionErrors errors = new ActionErrors(); Well, this is not true. According to the code, the errors object gets passed to the initValidator( ) method which returns a Validator object, and the validator object than calls the validate() method. Since Java pass by reference, the error object could be changed in the initValidator() method as well as in the subsequent validate() method. Saul If errors ARE found, they're never put into that ActionErrors object, they're stored in the protected ValidatorResults object. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return codeActionErrors/code object that encapsulates any validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { this.setPageFromDynaProperty(); ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); Validator validator = Resources.initValidator(mapping.getAttribute(), this, application, request, errors, page); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } Can someone who knows what's happening with ActionError/ActionErrors please post a summary? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - 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: ActionErrors and Servlet Filters
you may use following request.setAttribute(Globals.ERROR_KEY, errors); to set global parameter of errors.. set action error as usual... Nate Drake wrote: I have a Servlet Filter that checks that the user has permission to access the requested page. If the user does not, I want to send them back to home.jsp. In home.jsp, I want to use the html:errors tag to display an error message. In the filter I do this: ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, error); request.setAttribute(errparam, errors); RequestDispatcher rd = request.getRequestDispatcher(home.jsp); rd.forward(request, response); return; In home.jsp I've tried both: html:errors name=errparam/ html:errors property=errparam/ It forwards back to home.jsp, but the error messages are not displayed. Is it possible to use ActionErrors outside of an Action? Thanks, Nate - 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: ActionErrors and Servlet Filters
In addition to below reply: you may set name in html:error and . request.setAttribute(name, errors) errors can be string, string[], ActionErrors, ErrorMesssages Manish Singla wrote: you may use following request.setAttribute(Globals.ERROR_KEY, errors); to set global parameter of errors.. set action error as usual... Nate Drake wrote: I have a Servlet Filter that checks that the user has permission to access the requested page. If the user does not, I want to send them back to home.jsp. In home.jsp, I want to use the html:errors tag to display an error message. In the filter I do this: ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, error); request.setAttribute(errparam, errors); RequestDispatcher rd = request.getRequestDispatcher(home.jsp); rd.forward(request, response); return; In home.jsp I've tried both: html:errors name=errparam/ html:errors property=errparam/ It forwards back to home.jsp, but the error messages are not displayed. Is it possible to use ActionErrors outside of an Action? Thanks, Nate - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: ActionErrors and Servlet Filters
I think you need to implement the saveErrors() method some where in your code. You may also need to import the Action class in your Servlet Filter. Also you could check to make sure you have imported the html taglibrary in your home.jsp -Ursprungliche Nachricht- Von: Nate Drake [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 26. September 2003 02:08 An: [EMAIL PROTECTED] Betreff: ActionErrors and Servlet Filters I have a Servlet Filter that checks that the user has permission to access the requested page. If the user does not, I want to send them back to home.jsp. In home.jsp, I want to use the html:errors tag to display an error message. In the filter I do this: ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, error); request.setAttribute(errparam, errors); RequestDispatcher rd = request.getRequestDispatcher(home.jsp); rd.forward(request, response); return; In home.jsp I've tried both: html:errors name=errparam/ html:errors property=errparam/ It forwards back to home.jsp, but the error messages are not displayed. Is it possible to use ActionErrors outside of an Action? Thanks, Nate - 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: AW: ActionErrors and Servlet Filters
... errors.add(errparam, error); request.setAttribute(Globals.ERROR_KEY, errors); ... html:errors property=errparam/ Quoting [EMAIL PROTECTED]: I think you need to implement the saveErrors() method some where in your code. You may also need to import the Action class in your Servlet Filter. Also you could check to make sure you have imported the html taglibrary in your home.jsp -Ursprungliche Nachricht- Von: Nate Drake [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 26. September 2003 02:08 An: [EMAIL PROTECTED] Betreff: ActionErrors and Servlet Filters I have a Servlet Filter that checks that the user has permission to access the requested page. If the user does not, I want to send them back to home.jsp. In home.jsp, I want to use the html:errors tag to display an error message. In the filter I do this: ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, error); request.setAttribute(errparam, errors); RequestDispatcher rd = request.getRequestDispatcher(home.jsp); rd.forward(request, response); return; In home.jsp I've tried both: html:errors name=errparam/ html:errors property=errparam/ It forwards back to home.jsp, but the error messages are not displayed. Is it possible to use ActionErrors outside of an Action? Thanks, Nate - 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] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionErrors and Servlet Filters
I have a Servlet Filter that checks that the user has permission to access the requested page. If the user does not, I want to send them back to home.jsp. In home.jsp, I want to use the html:errors tag to display an error message. In the filter I do this: ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, error); request.setAttribute(errparam, errors); RequestDispatcher rd = request.getRequestDispatcher(home.jsp); rd.forward(request, response); return; In home.jsp I've tried both: html:errors name=errparam/ html:errors property=errparam/ It forwards back to home.jsp, but the error messages are not displayed. Is it possible to use ActionErrors outside of an Action? Thanks, Nate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
setting an ActionErrors object for a form outside a validate method...
My Action class does some processing that involves going to the database. This work could throw a SQLException and I want that to generate an error message for the user. However I don't want to do this work in the validate method, only to have to do it again in the execute method (besides SQLExceptions can be non-determinate so this wouldn't solve the problem anyway). So, my question is how can I add an ActionErrors object to my form from within the execute method so I can send the user back to their requesting page with an intelligent and well formatted message? Thanks, alan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: setting an ActionErrors object for a form outside a validate method...
Hi Alan, Here are the basics: public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors; ActionError error; //create the errors errors = new ActionErrors(); ... do your validation, and if error //create the error error = new ActionError(error.resource.key); //add it to the errors (global or form field name based) this uses global errors.add(ActionErrors.GLOBAL_ERROR, error); ...perform rest of method if (errors.isEmpty() == false) { //save the error saveErrors(request, errors); //go back to same page return mapping.getInputForward(); } // Forward control to the specified success URI return (mapping.findForward(success)); } Hope this helps. Chuck -Original Message- From: alan [mailto:[EMAIL PROTECTED] Sent: Saturday, September 20, 2003 11:10 AM To: [EMAIL PROTECTED] Subject: setting an ActionErrors object for a form outside a validate method... My Action class does some processing that involves going to the database. This work could throw a SQLException and I want that to generate an error message for the user. However I don't want to do this work in the validate method, only to have to do it again in the execute method (besides SQLExceptions can be non-determinate so this wouldn't solve the problem anyway). So, my question is how can I add an ActionErrors object to my form from within the execute method so I can send the user back to their requesting page with an intelligent and well formatted message? Thanks, alan - 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: setting an ActionErrors object for a form outside a validate method...
Thank you. saveErrors() had eluded me. -Original Message- From: Charles Canning [mailto:[EMAIL PROTECTED] Sent: Saturday, September 20, 2003 11:52 AM To: 'Struts Users Mailing List' Subject: RE: setting an ActionErrors object for a form outside a validate method... Hi Alan, Here are the basics: public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors; ActionError error; //create the errors errors = new ActionErrors(); ... do your validation, and if error //create the error error = new ActionError(error.resource.key); //add it to the errors (global or form field name based) this uses global errors.add(ActionErrors.GLOBAL_ERROR, error); ...perform rest of method if (errors.isEmpty() == false) { //save the error saveErrors(request, errors); //go back to same page return mapping.getInputForward(); } // Forward control to the specified success URI return (mapping.findForward(success)); } Hope this helps. Chuck -Original Message- From: alan [mailto:[EMAIL PROTECTED] Sent: Saturday, September 20, 2003 11:10 AM To: [EMAIL PROTECTED] Subject: setting an ActionErrors object for a form outside a validate method... My Action class does some processing that involves going to the database. This work could throw a SQLException and I want that to generate an error message for the user. However I don't want to do this work in the validate method, only to have to do it again in the execute method (besides SQLExceptions can be non-determinate so this wouldn't solve the problem anyway). So, my question is how can I add an ActionErrors object to my form from within the execute method so I can send the user back to their requesting page with an intelligent and well formatted message? Thanks, alan - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionErrors
Hello, This works fine: errors.add(ActionErrors.GLOBAL_ERROR,new ActionError(errors.createkunde.float)); but i want to define the message at runtime, i want to put a string into the ActionError that is not defined in .properties file. Is that possible ? if yes, could u give me a example ? thnx for help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionErrors
Hi, You can use the placeholder ({0}, {1} ..) feature in message resource something like this: In property file: errors.your_runtime_msg.key = {0} In Action or form bean: new ActionError(errors.your_runtime_msg.key, your runtime message, blah, blah..); your runtime message, blah, blah.. will replace {0} Saul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 11:45 AM To: [EMAIL PROTECTED] Subject: ActionErrors Hello, This works fine: errors.add(ActionErrors.GLOBAL_ERROR,new ActionError(errors.createkunde.float)); but i want to define the message at runtime, i want to put a string into the ActionError that is not defined in .properties file. Is that possible ? if yes, could u give me a example ? thnx for help - 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: ExceptionHandler storing ActionErrors in session
When the declarative exception handling was introduced, I was very concerned about the scope attribute in the ExceptionConfig. It is a redundant attribute if we obey the following rules: 1) All exceptions that could reach to the exception handler should be fatal errors. 2) Fatal errors should be consumed and/or logged in the current thread. The ErrorsTag, MessagesTag, and utility classes were correctly designed to handle request scoped ActionErrors. And the rules are consistent with the servlet engines' error handling mechanism: Any system errors will be output and/or logged in the current thread. Further more, any fatal/system errors from EJB and database must be reported during one invoking method (also in one thread). So in 99% use cases, you do not need to store ActionErrors in the session scope. If the scope attribute was removed, then some bug reports regarding to the exception handling would not be there. Forgetting about session is the *cleanest* solution from my point of view. If the 1% users REALLY want to store ActionErrors in the session scope, they could extend the base exception handler class with the following questions to be answered: 1) When an object is stored in a session, the object should serve some purposes across request threads. If fatal errors do not get handled in the current thread and stored in the session, which later request thread will take care of them? 2) If non-fatal errors are stored in a session and some later request threads may be interested in the non-fatal errors and make decision based on them, then consider do the non-fatal *errors* really qualify as errors? In other words, should they be caught or processed within the Action.execute() method and stored as business objects? It is very likely to over kill a problem if session scoped ActionErrors are used. It only gives you more troubles than problems solved. Jing Netspread Carrier http://www.netspread.com - Original Message - From: Robert Taylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 1:58 PM Subject: ExceptionHandler storing ActionErrors in session I'm just starting to fiddle around with ExceptionHandlers and was wondering how and when ActionErrors are removed from session scoped if configured to be stored there. I took a look at the ErrorsTag and the MessagesTag (because I'm assuming these tags would be used to render the ActionErrors) and didn't see provisions for removing ActionErrors from session scope. I must have missed something obvious here and would appreciate anyone who could point me in the right direction. robert - 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]
ExceptionHandler storing ActionErrors in session
I'm just starting to fiddle around with ExceptionHandlers and was wondering how and when ActionErrors are removed from session scoped if configured to be stored there. I took a look at the ErrorsTag and the MessagesTag (because I'm assuming these tags would be used to render the ActionErrors) and didn't see provisions for removing ActionErrors from session scope. I must have missed something obvious here and would appreciate anyone who could point me in the right direction. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ExceptionHandler storing ActionErrors in session
I don't believe there is currently a way to remove messages from the session. How would Struts know when to remove them? I have written a small subclass of ActionMessages that only returns its messages once. This allows me to store messages in the session without them being displayed multiple times. You're not the first person to need this feature so maybe it's time to float the subclass idea on struts-dev (unless there is a better way). David --- Robert Taylor [EMAIL PROTECTED] wrote: I'm just starting to fiddle around with ExceptionHandlers and was wondering how and when ActionErrors are removed from session scoped if configured to be stored there. I took a look at the ErrorsTag and the MessagesTag (because I'm assuming these tags would be used to render the ActionErrors) and didn't see provisions for removing ActionErrors from session scope. I must have missed something obvious here and would appreciate anyone who could point me in the right direction. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ExceptionHandler storing ActionErrors in session
What about adding a symmetrical removeErrors()/removeMessages() to Action? -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 5:21 PM To: Struts Users Mailing List Subject: Re: ExceptionHandler storing ActionErrors in session I don't believe there is currently a way to remove messages from the session. How would Struts know when to remove them? I have written a small subclass of ActionMessages that only returns its messages once. This allows me to store messages in the session without them being displayed multiple times. You're not the first person to need this feature so maybe it's time to float the subclass idea on struts-dev (unless there is a better way). David --- Robert Taylor [EMAIL PROTECTED] wrote: I'm just starting to fiddle around with ExceptionHandlers and was wondering how and when ActionErrors are removed from session scoped if configured to be stored there. I took a look at the ErrorsTag and the MessagesTag (because I'm assuming these tags would be used to render the ActionErrors) and didn't see provisions for removing ActionErrors from session scope. I must have missed something obvious here and would appreciate anyone who could point me in the right direction. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - 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]