Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
OK, I have gotten to where I know what is happening. Now, I hope someone can help me to understand why. The ActionMessage is getting properly saved in the request and the html:error or html:message tag is finding it ( I can see all this in the debuger) Further, the error has a valid key into the current application resouces . Other tags bean:message are happily returning messages from that resource. html:error happily prints a bullet with nothing beside it My conclusion: for some reason, the message is not being retrieved from the resources file Anybody got a clue? -- L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 [EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
Joe wroteA common case here would be if you are returning a redirecting forward; in that case, the JSP would be drawn in response to a second HTTP request, and the saved errors would have been lost. No, nothing special just the plain vanilla form-jsp setup. struts-config snips: form-bean name=logonForm type=us.glsi.base.LogonForm/ !-- Logon Action -- action path=/logon type=org.apache.struts.actions.ForwardAction forward=/index.jsp/ action path=/submit_logon type=us.glsi.base.LogonAction name=logonForm scope=request validate=true input=/index.jsp forward name=success path=/pub_home.do/ /action And Yes, my taglibs are bound to h:, l:, . (less typing ;-) -- L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 [EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
At 8:03 AM -0400 4/14/05, Les Dunaway wrote: What am I messing up? In the code you included in your email, you were not saving the errors. If that's not just a copy/paste mistake, then there's your problem. Joe I am having problems with Struts 1.2.4 ActionMessage / ActionError. I'm using a setup like recommended on the wiki ActionMessages am = new ActionMessages(); am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( not.authorized.for.account ) ); saveErrors( request, am ); html:messages id=msg message=false bean:write name=msg / /html:messages My code: LogonAction: ActionMessages errors = new ActionMessages(); if(!ud.isUserExist(username)){ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(error.logon.invalid.user)); log.debug(Invalid User: + username + Errors: + errors.toString()); Logon.jsp h:messages id=msg message=false b:write name=msg / /h:messages Log4j from above: 102383 [http-8084-Processor42] DEBUG us.glsi.base.LogonAction - Invalid User: ferd Errors: {org.apache.struts.action.GLOBAL_MESSAGE=[error.logon.invalid.user[]]} I'm getting 2005-04-14 07:31:14 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: Cannot find bean msg in any scope That says to me that the html:messages tag is seeing that there are messages (and there are, I can see that in my log4j output) and then the bean:write tag isn't seeing the msg bean that the messages tag should have created?? Right? Les L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 [EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
At 8:55 AM -0700 4/14/05, K.C. Baltz wrote: Perhaps you should be using h:errors to display your error messages instead of h:messages I think it depends on if you use saveErrors or saveMessages in your Action. This is NOT true. The differences between the h:errors tag and the h:messages tag are functional, but both can be used to iterate through any instance of ActionMessages, and both default to using the ActionMessages saved as a result of calling saveErrors. Read Niall's thorough write-up for full details: http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
I stand corrected and informed. Now that you mention it, I remember looking into this before. I wish the Struts Users Guide HTML tag API made the difference a little more obvious in the description. I'm not saying the documentation is incorrect, just that the quick skim I did before I sent my email didn't make the difference clear. It didn't help that the doc for :errors only mentions displaying an ActionErrors object whereas the :messages one references ActionMessages and ActionErrors. K.C. Joe Germuska wrote: At 8:55 AM -0700 4/14/05, K.C. Baltz wrote: Perhaps you should be using h:errors to display your error messages instead of h:messages I think it depends on if you use saveErrors or saveMessages in your Action. This is NOT true. The differences between the h:errors tag and the h:messages tag are functional, but both can be used to iterate through any instance of ActionMessages, and both default to using the ActionMessages saved as a result of calling saveErrors. Read Niall's thorough write-up for full details: http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html Joe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
At 11:19 AM -0700 4/14/05, K.C. Baltz wrote: I stand corrected and informed. Now that you mention it, I remember looking into this before. I wish the Struts Users Guide HTML tag API made the difference a little more obvious in the description. I'm not saying the documentation is incorrect, just that the quick skim I did before I sent my email didn't make the difference clear. It didn't help that the doc for :errors only mentions displaying an ActionErrors object whereas the :messages one references ActionMessages and ActionErrors. Good point! If you could put a ticket in Bugzilla, hopefully your point won't be forgotten. If you wanted to provide proposed alternative text, so much the better... http://issues.apache.org/bugzilla/enter_bug.cgi?product=Struts Joe K.C. Joe Germuska wrote: At 8:55 AM -0700 4/14/05, K.C. Baltz wrote: Perhaps you should be using h:errors to display your error messages instead of h:messages I think it depends on if you use saveErrors or saveMessages in your Action. This is NOT true. The differences between the h:errors tag and the h:messages tag are functional, but both can be used to iterate through any instance of ActionMessages, and both default to using the ActionMessages saved as a result of calling saveErrors. Read Niall's thorough write-up for full details: http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html Joe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
Joe, Thanks for looking at it. Yes, I am saving the errors - I cut it too short here's all the code if(!ud.isUserExist(username)){ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(error.logon.invalid.user)); log.debug(Invalid User: + username + Errors: + errors.toString()); } else errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(error.logon.invalid.password)); saveErrors(request,errors); Les Joe Germuska wrote: At 8:03 AM -0400 4/14/05, Les Dunaway wrote: What am I messing up? In the code you included in your email, you were not saving the errors. If that's not just a copy/paste mistake, then there's your problem. Joe I am having problems with Struts 1.2.4 ActionMessage / ActionError. I'm using a setup like recommended on the wiki ActionMessages am = new ActionMessages(); am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( not.authorized.for.account ) ); saveErrors( request, am ); html:messages id=msg message=false bean:write name=msg / /html:messages My code: LogonAction: ActionMessages errors = new ActionMessages(); if(!ud.isUserExist(username)){ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(error.logon.invalid.user)); log.debug(Invalid User: + username + Errors: + errors.toString()); Logon.jsp h:messages id=msg message=false b:write name=msg / /h:messages Log4j from above: 102383 [http-8084-Processor42] DEBUG us.glsi.base.LogonAction - Invalid User: ferd Errors: {org.apache.struts.action.GLOBAL_MESSAGE=[error.logon.invalid.user[]]} I'm getting 2005-04-14 07:31:14 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: Cannot find bean msg in any scope That says to me that the html:messages tag is seeing that there are messages (and there are, I can see that in my log4j output) and then the bean:write tag isn't seeing the msg bean that the messages tag should have created?? Right? Les L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 [EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 [EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
At 3:24 PM -0400 4/14/05, Les Dunaway wrote: Joe, Thanks for looking at it. Yes, I am saving the errors - I cut it too short here's all the code if(!ud.isUserExist(username)){ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(error.logon.invalid.user)); log.debug(Invalid User: + username + Errors: + errors.toString()); } else errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(error.logon.invalid.password)); saveErrors(request,errors); A common case here would be if you are returning a redirecting forward; in that case, the JSP would be drawn in response to a second HTTP request, and the saved errors would have been lost. There have been some efforts to support session-scoped message saving in recent versions of Struts, but I must admit I'm not fully up to speed on the status or techniques. If that's not it, I'm still puzzled: h:messages id=msg message=false b:write name=msg / /h:messages Log4j from above: 102383 [http-8084-Processor42] DEBUG us.glsi.base.LogonAction - Invalid User: ferd Errors: {org.apache.struts.action.GLOBAL_MESSAGE=[error.logon.invalid.user[]]} I'm getting 2005-04-14 07:31:14 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: Cannot find bean msg in any scope the code inside h:messages should never execute if there are no messages. Is it possible that you don't have the h prefix bound to any taglibrary? In that case, the JSP interpreter would ignore those tags but it wouldn't ignore their contents. Obviously you have b bound, or you wouldn't be getting any errors. Joe Les Joe Germuska wrote: At 8:03 AM -0400 4/14/05, Les Dunaway wrote: What am I messing up? In the code you included in your email, you were not saving the errors. If that's not just a copy/paste mistake, then there's your problem. Joe I am having problems with Struts 1.2.4 ActionMessage / ActionError. I'm using a setup like recommended on the wiki ActionMessages am = new ActionMessages(); am.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( not.authorized.for.account ) ); saveErrors( request, am ); html:messages id=msg message=false bean:write name=msg / /html:messages My code: LogonAction: ActionMessages errors = new ActionMessages(); if(!ud.isUserExist(username)){ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(error.logon.invalid.user)); log.debug(Invalid User: + username + Errors: + errors.toString()); Logon.jsp h:messages id=msg message=false b:write name=msg / /h:messages Log4j from above: 102383 [http-8084-Processor42] DEBUG us.glsi.base.LogonAction - Invalid User: ferd Errors: {org.apache.struts.action.GLOBAL_MESSAGE=[error.logon.invalid.user[]]} I'm getting 2005-04-14 07:31:14 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: Cannot find bean msg in any scope That says to me that the html:messages tag is seeing that there are messages (and there are, I can see that in my log4j output) and then the bean:write tag isn't seeing the msg bean that the messages tag should have created?? Right? Les L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 mailto:[EMAIL PROTECTED][EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover - To unsubscribe, e-mail: mailto:[EMAIL PROTECTED][EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED][EMAIL PROTECTED] -- L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 mailto:[EMAIL PROTECTED][EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
Done: http://issues.apache.org/bugzilla/show_bug.cgi?id=34460 K.C. Joe Germuska wrote: At 11:19 AM -0700 4/14/05, K.C. Baltz wrote: I stand corrected and informed. Now that you mention it, I remember looking into this before. I wish the Struts Users Guide HTML tag API made the difference a little more obvious in the description. I'm not saying the documentation is incorrect, just that the quick skim I did before I sent my email didn't make the difference clear. It didn't help that the doc for :errors only mentions displaying an ActionErrors object whereas the :messages one references ActionMessages and ActionErrors. Good point! If you could put a ticket in Bugzilla, hopefully your point won't be forgotten. If you wanted to provide proposed alternative text, so much the better... http://issues.apache.org/bugzilla/enter_bug.cgi?product=Struts Joe K.C. Joe Germuska wrote: At 8:55 AM -0700 4/14/05, K.C. Baltz wrote: Perhaps you should be using h:errors to display your error messages instead of h:messages I think it depends on if you use saveErrors or saveMessages in your Action. This is NOT true. The differences between the h:errors tag and the h:messages tag are functional, but both can be used to iterate through any instance of ActionMessages, and both default to using the ActionMessages saved as a result of calling saveErrors. Read Niall's thorough write-up for full details: http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html Joe - 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]