Re: Rewriting an application in Struts2 from Struts 1
2012/10/19 Srineel Mazumdar smaz19...@gmail.com: Hi, I am trying t rewrite the jpetstore project in Struts 2. I am referring to the Struts 1 implementation of the petstore project. I am having the following problem : There is an entry : action path=/shop/editAccount type=org.springframework.samples.jpetstore.web.struts.EditAccountAction name=workingAccountForm scope=session validate=true input=/WEB-INF/jsp/struts/EditAccountForm.jsp forward name=success path=/shop/index.do/ /action in strutsconfig.xml. What should be the equivalent entry in struts.xml for this entry in Struts1 ? action name=editAccount namespace=/shop class=org.springframework.samples.jpetstore.web.struts.EditAccountAction result type=redirectAction param name=actionNameindex/param param name=namespace/shop/param /result result name=input/WEB-INF/jsp/struts/EditAccountForm.jsp/result /action Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
getText in error messages: resource bundle or bean value?
Hi, I'm having a problem with getText(). I have the following xml validator: field name=user.confirmPassword field-validator type=requiredstring message key=errors.required/ /field-validator field-validator type=fieldexpression param name=expression (user.confirmPassword.equals(user.password)) /param message key=errors.confirmPassSame/ /field-validator /field And the error message is defined in a bundle like this: errors.confirmPassSame=The ${getText(user.confirmPassword)} field has to have the same value as the ${getText(user.password)} field. ... user.confirmPassword=Confirm Password user.password=Password I would expect a message like: The Confirm Password field has to have the same value as the Password field. However, when the error message is shown, instead of the text from the resource bundle, what is shown are the actual values of the bean, like this: The abcd field has to have the same value as the 1234 field. Is this a bug in getText()? Cheers, J. Garcia
Re: getText in error messages: resource bundle or bean value?
Mi mistake. Sorry. The resource error message I was using is in fact: errors.confirmPassSame=The ${user.confirmPassword} field has to have the same value as the ${user.password} field. whereas it should be: errors.confirmPassSame=The ${getText(user.confirmPassword)} field has to have the same value as the ${getText(user.password)} field. Solved! On Fri, Oct 19, 2012 at 2:10 PM, J. Garcia jogaco...@gmail.com wrote: Hi, I'm having a problem with getText(). I have the following xml validator: field name=user.confirmPassword field-validator type=requiredstring message key=errors.required/ /field-validator field-validator type=fieldexpression param name=expression (user.confirmPassword.equals(user.password)) /param message key=errors.confirmPassSame/ /field-validator /field And the error message is defined in a bundle like this: errors.confirmPassSame=The ${getText(user.confirmPassword)} field has to have the same value as the ${getText(user.password)} field. ... user.confirmPassword=Confirm Password user.password=Password I would expect a message like: The Confirm Password field has to have the same value as the Password field. However, when the error message is shown, instead of the text from the resource bundle, what is shown are the actual values of the bean, like this: The abcd field has to have the same value as the 1234 field. Is this a bug in getText()? Cheers, J. Garcia
RE: getText in error messages: resource bundle or bean value?
I believe that your problem is that the field names are the same as your label names and with the validator both are in the stack. ${getText(user.password)} is first evaluating user.password and finding the field value 1234. getText is then trying to locate an entry for 1234 and cannot find one so it is just return 1234. It might work if you try ${getText('user.password')}. Otherwise, you may need to rename it. -Original Message- From: J. Garcia [mailto:jogaco...@gmail.com] Sent: Friday, October 19, 2012 8:10 AM To: Struts Users Mailing List Subject: getText in error messages: resource bundle or bean value? Hi, I'm having a problem with getText(). I have the following xml validator: field name=user.confirmPassword field-validator type=requiredstring message key=errors.required/ /field-validator field-validator type=fieldexpression param name=expression (user.confirmPassword.equals(user.password)) /param message key=errors.confirmPassSame/ /field-validator /field And the error message is defined in a bundle like this: errors.confirmPassSame=The ${getText(user.confirmPassword)} field has to have the same value as the ${getText(user.password)} field. ... user.confirmPassword=Confirm Password user.password=Password I would expect a message like: The Confirm Password field has to have the same value as the Password field. However, when the error message is shown, instead of the text from the resource bundle, what is shown are the actual values of the bean, like this: The abcd field has to have the same value as the 1234 field. Is this a bug in getText()? Cheers, J. Garcia - ***Note:The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the Sender immediately by replying to the message and deleting it from your computer. Thank you. Premier Inc. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: getText in error messages: resource bundle or bean value?
You are right! On Fri, Oct 19, 2012 at 2:54 PM, Hoying, Ken ken_hoy...@premierinc.comwrote: I believe that your problem is that the field names are the same as your label names and with the validator both are in the stack. ${getText(user.password)} is first evaluating user.password and finding the field value 1234. getText is then trying to locate an entry for 1234 and cannot find one so it is just return 1234. It might work if you try ${getText('user.password')}. Otherwise, you may need to rename it. -Original Message- From: J. Garcia [mailto:jogaco...@gmail.com] Sent: Friday, October 19, 2012 8:10 AM To: Struts Users Mailing List Subject: getText in error messages: resource bundle or bean value? Hi, I'm having a problem with getText(). I have the following xml validator: field name=user.confirmPassword field-validator type=requiredstring message key=errors.required/ /field-validator field-validator type=fieldexpression param name=expression (user.confirmPassword.equals(user.password)) /param message key=errors.confirmPassSame/ /field-validator /field And the error message is defined in a bundle like this: errors.confirmPassSame=The ${getText(user.confirmPassword)} field has to have the same value as the ${getText(user.password)} field. ... user.confirmPassword=Confirm Password user.password=Password I would expect a message like: The Confirm Password field has to have the same value as the Password field. However, when the error message is shown, instead of the text from the resource bundle, what is shown are the actual values of the bean, like this: The abcd field has to have the same value as the 1234 field. Is this a bug in getText()? Cheers, J. Garcia - ***Note:The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the Sender immediately by replying to the message and deleting it from your computer. Thank you. Premier Inc. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: implementaiton advise on custom TextProvider
Thanks man! I'll check it out this morning. I think the protected seems like a great idea. It's an interesting question, whether to make such things protected or private. -Original Message- From: Lukasz Lenart [mailto:lukaszlen...@apache.org] Sent: Thursday, October 18, 2012 11:59 PM To: Struts Users Mailing List Subject: Re: implementaiton advise on custom TextProvider 2012/10/18 Davis, Chad chad.da...@emc.com: Of course, and I'd even be happy to do the work. Perhaps you can advise me on a plan? Everything is ready, I'm just waiting for you to register the issue ;-) I created the ticket. Let me know if the ticket conforms with struts2 standards for ticket submission; I'll be happy to edit it. Ok, thanks! Everything is ok, please check and test my solution. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Rewriting an application in Struts2 from Struts 1
Also would like to add another thing : If I add the following line : package name=newpetstore extends=struts-default namespace=/shop then I think I do not need to add namespace in all the entries?? On Fri, Oct 19, 2012 at 9:28 AM, Srineel Mazumdar smaz19...@gmail.comwrote: Hi, I am trying t rewrite the jpetstore project in Struts 2. I am referring to the Struts 1 implementation of the petstore project. I am having the following problem : There is an entry : action path=/shop/editAccount type=org.springframework.samples.jpetstore.web.struts.EditAccountAction name=workingAccountForm scope=session validate=true input=/WEB-INF/jsp/struts/EditAccountForm.jsp forward name=success path=/shop/index.do/ /action in strutsconfig.xml. What should be the equivalent entry in struts.xml for this entry in Struts1 ? Regards, Srineel