Re: Currency Formatting
I broke this down into a very simple example tonight. Just two JSP pages. test1.jsp which has s:include value=test2.jsp/ and test2.jsp which has s:text name=format.currencys:param value=price//s:text/span I have TestAction which has a simple getPrice which returns a Double. I have created two actions: result name=success/jsp/shopview/getProduct.jsp/result action name=test1 class=actions.TestAction method=test1 result name=success/test1.jsp/result /action action name=test1 class=actions.TestAction method=test2 result name=success/test2.jsp/result /action When I forward straight to the page which has the s:text it works. If I forward to the page which includes the page which has the s:text it stops rendering. No errors. Can not trace it in the code. Must be a problem with the way the output is being written to the stream? This is recreatable if you try doing the include above. Can not figure this out? Thanks Chris - Original Message - From: Chris Miles ch...@chrismiles.org To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 11:21 PM Subject: Re: Currency Formatting On further digging I have found out some more info. My action is /shop/getProduct.action?productId=61 The action is defined as follows: action name=getProduct class=org.chrismiles.sentiments.struts2.shop.GetProductAction result name=success/shop.jsp?content=/jsp/shopview/getProduct.jsp/result /action shop.jsp is basically main template page in which the content changes inside. It contains the following line s:include value=%{#parameters.content}/ So no matter what action I call I can forward to the shop page as the view and include the custom view page which in the above example is the getProduct jsp page. For testing I just used the following action result to go straight to the individual view page. result name=success/jsp/shopview/getProduct.jsp/result which includes s:text name=format.currencys:param value=product.price//s:text/span and it renders every thing successfully and even includes a localised £ sign which. Does this help shed any further light on it? Something in the including mechanism which is messing things up? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:10 AM Subject: Re: Currency Formatting That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span
Re: Currency Formatting
If that's actually a cut-n-paste job from the files, I can see the error, if you retyped it, it's probably just a typo. But, you have a close tag after the s:param and before it's arguments, which is making it invalid, and would definitely cause the JSP processor to puke. Try the below instead: (*Chris*) s:text name=format.currencys:param value=price//s:text On Thu, Jul 15, 2010 at 12:16 PM, Chris Miles ch...@chrismiles.org wrote: I broke this down into a very simple example tonight. Just two JSP pages. test1.jsp which has s:include value=test2.jsp/ and test2.jsp which has s:text name=format.currencys:param value=price//s:text/span I have TestAction which has a simple getPrice which returns a Double. I have created two actions: result name=success/jsp/shopview/getProduct.jsp/result action name=test1 class=actions.TestAction method=test1 result name=success/test1.jsp/result /action action name=test1 class=actions.TestAction method=test2 result name=success/test2.jsp/result /action When I forward straight to the page which has the s:text it works. If I forward to the page which includes the page which has the s:text it stops rendering. No errors. Can not trace it in the code. Must be a problem with the way the output is being written to the stream? This is recreatable if you try doing the include above. Can not figure this out? Thanks Chris - Original Message - From: Chris Miles ch...@chrismiles.org To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 11:21 PM Subject: Re: Currency Formatting On further digging I have found out some more info. My action is /shop/getProduct.action?productId=61 The action is defined as follows: action name=getProduct class=org.chrismiles.sentiments.struts2.shop.GetProductAction result name=success/shop.jsp?content=/jsp/shopview/getProduct.jsp/result /action shop.jsp is basically main template page in which the content changes inside. It contains the following line s:include value=%{#parameters.content}/ So no matter what action I call I can forward to the shop page as the view and include the custom view page which in the above example is the getProduct jsp page. For testing I just used the following action result to go straight to the individual view page. result name=success/jsp/shopview/getProduct.jsp/result which includes s:text name=format.currencys:param value=product.price//s:text/span and it renders every thing successfully and even includes a localised £ sign which. Does this help shed any further light on it? Something in the including mechanism which is messing things up? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:10 AM Subject: Re: Currency Formatting That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span
Re: Currency Formatting
Yeah sorry was just a paste typo. :( Basically if you try the format, but do it in a JSP being included by another JSP as the result of an Action the problem is recreated. Bit much to ask. If it helps yourself or anyone I can make up a dummy project showing the issue to take out the leg work? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, July 15, 2010 8:24 PM Subject: Re: Currency Formatting If that's actually a cut-n-paste job from the files, I can see the error, if you retyped it, it's probably just a typo. But, you have a close tag after the s:param and before it's arguments, which is making it invalid, and would definitely cause the JSP processor to puke. Try the below instead: (*Chris*) s:text name=format.currencys:param value=price//s:text On Thu, Jul 15, 2010 at 12:16 PM, Chris Miles ch...@chrismiles.org wrote: I broke this down into a very simple example tonight. Just two JSP pages. test1.jsp which has s:include value=test2.jsp/ and test2.jsp which has s:text name=format.currencys:param value=price//s:text/span I have TestAction which has a simple getPrice which returns a Double. I have created two actions: result name=success/jsp/shopview/getProduct.jsp/result action name=test1 class=actions.TestAction method=test1 result name=success/test1.jsp/result /action action name=test1 class=actions.TestAction method=test2 result name=success/test2.jsp/result /action When I forward straight to the page which has the s:text it works. If I forward to the page which includes the page which has the s:text it stops rendering. No errors. Can not trace it in the code. Must be a problem with the way the output is being written to the stream? This is recreatable if you try doing the include above. Can not figure this out? Thanks Chris - Original Message - From: Chris Miles ch...@chrismiles.org To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 11:21 PM Subject: Re: Currency Formatting On further digging I have found out some more info. My action is /shop/getProduct.action?productId=61 The action is defined as follows: action name=getProduct class=org.chrismiles.sentiments.struts2.shop.GetProductAction result name=success/shop.jsp?content=/jsp/shopview/getProduct.jsp/result /action shop.jsp is basically main template page in which the content changes inside. It contains the following line s:include value=%{#parameters.content}/ So no matter what action I call I can forward to the shop page as the view and include the custom view page which in the above example is the getProduct jsp page. For testing I just used the following action result to go straight to the individual view page. result name=success/jsp/shopview/getProduct.jsp/result which includes s:text name=format.currencys:param value=product.price//s:text/span and it renders every thing successfully and even includes a localised £ sign which. Does this help shed any further light on it? Something in the including mechanism which is messing things up? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:10 AM Subject: Re: Currency Formatting That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing
Re: Currency Formatting
I just use Tiles to do my page composition, so I don't have places where JSP's include other JSP's. Probably why I haven't run across anything like this. It might take one of the core developers that are familiar with the internals of these tags to give them a look, or you could venture into that cold dark land yourself... (*Chris*) On Thu, Jul 15, 2010 at 2:05 PM, Chris Miles ch...@chrismiles.org wrote: Yeah sorry was just a paste typo. :( Basically if you try the format, but do it in a JSP being included by another JSP as the result of an Action the problem is recreated. Bit much to ask. If it helps yourself or anyone I can make up a dummy project showing the issue to take out the leg work? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, July 15, 2010 8:24 PM Subject: Re: Currency Formatting If that's actually a cut-n-paste job from the files, I can see the error, if you retyped it, it's probably just a typo. But, you have a close tag after the s:param and before it's arguments, which is making it invalid, and would definitely cause the JSP processor to puke. Try the below instead: (*Chris*) s:text name=format.currencys:param value=price//s:text On Thu, Jul 15, 2010 at 12:16 PM, Chris Miles ch...@chrismiles.org wrote: I broke this down into a very simple example tonight. Just two JSP pages. test1.jsp which has s:include value=test2.jsp/ and test2.jsp which has s:text name=format.currencys:param value=price//s:text/span I have TestAction which has a simple getPrice which returns a Double. I have created two actions: result name=success/jsp/shopview/getProduct.jsp/result action name=test1 class=actions.TestAction method=test1 result name=success/test1.jsp/result /action action name=test1 class=actions.TestAction method=test2 result name=success/test2.jsp/result /action When I forward straight to the page which has the s:text it works. If I forward to the page which includes the page which has the s:text it stops rendering. No errors. Can not trace it in the code. Must be a problem with the way the output is being written to the stream? This is recreatable if you try doing the include above. Can not figure this out? Thanks Chris - Original Message - From: Chris Miles ch...@chrismiles.org To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 11:21 PM Subject: Re: Currency Formatting On further digging I have found out some more info. My action is /shop/getProduct.action?productId=61 The action is defined as follows: action name=getProduct class=org.chrismiles.sentiments.struts2.shop.GetProductAction result name=success/shop.jsp?content=/jsp/shopview/getProduct.jsp/result /action shop.jsp is basically main template page in which the content changes inside. It contains the following line s:include value=%{#parameters.content}/ So no matter what action I call I can forward to the shop page as the view and include the custom view page which in the above example is the getProduct jsp page. For testing I just used the following action result to go straight to the individual view page. result name=success/jsp/shopview/getProduct.jsp/result which includes s:text name=format.currencys:param value=product.price//s:text/span and it renders every thing successfully and even includes a localised £ sign which. Does this help shed any further light on it? Something in the including mechanism which is messing things up? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:10 AM Subject: Re: Currency Formatting That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use
Re: Currency Formatting
Thanks might take a look into tiles or freemarker if I can find the time. Tried debugging the source but it is just too complex a stack with compiled JSPs. Just going to create a less elegant solution and have formatter String getter for any currencies. Just not worth the cost of investigating this. Thanks for your help Chris Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, July 15, 2010 10:17 PM Subject: Re: Currency Formatting I just use Tiles to do my page composition, so I don't have places where JSP's include other JSP's. Probably why I haven't run across anything like this. It might take one of the core developers that are familiar with the internals of these tags to give them a look, or you could venture into that cold dark land yourself... (*Chris*) On Thu, Jul 15, 2010 at 2:05 PM, Chris Miles ch...@chrismiles.org wrote: Yeah sorry was just a paste typo. :( Basically if you try the format, but do it in a JSP being included by another JSP as the result of an Action the problem is recreated. Bit much to ask. If it helps yourself or anyone I can make up a dummy project showing the issue to take out the leg work? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, July 15, 2010 8:24 PM Subject: Re: Currency Formatting If that's actually a cut-n-paste job from the files, I can see the error, if you retyped it, it's probably just a typo. But, you have a close tag after the s:param and before it's arguments, which is making it invalid, and would definitely cause the JSP processor to puke. Try the below instead: (*Chris*) s:text name=format.currencys:param value=price//s:text On Thu, Jul 15, 2010 at 12:16 PM, Chris Miles ch...@chrismiles.org wrote: I broke this down into a very simple example tonight. Just two JSP pages. test1.jsp which has s:include value=test2.jsp/ and test2.jsp which has s:text name=format.currencys:param value=price//s:text/span I have TestAction which has a simple getPrice which returns a Double. I have created two actions: result name=success/jsp/shopview/getProduct.jsp/result action name=test1 class=actions.TestAction method=test1 result name=success/test1.jsp/result /action action name=test1 class=actions.TestAction method=test2 result name=success/test2.jsp/result /action When I forward straight to the page which has the s:text it works. If I forward to the page which includes the page which has the s:text it stops rendering. No errors. Can not trace it in the code. Must be a problem with the way the output is being written to the stream? This is recreatable if you try doing the include above. Can not figure this out? Thanks Chris - Original Message - From: Chris Miles ch...@chrismiles.org To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 11:21 PM Subject: Re: Currency Formatting On further digging I have found out some more info. My action is /shop/getProduct.action?productId=61 The action is defined as follows: action name=getProduct class=org.chrismiles.sentiments.struts2.shop.GetProductAction result name=success/shop.jsp?content=/jsp/shopview/getProduct.jsp/result /action shop.jsp is basically main template page in which the content changes inside. It contains the following line s:include value=%{#parameters.content}/ So no matter what action I call I can forward to the shop page as the view and include the custom view page which in the above example is the getProduct jsp page. For testing I just used the following action result to go straight to the individual view page. result name=success/jsp/shopview/getProduct.jsp/result which includes s:text name=format.currencys:param value=product.price//s:text/span and it renders every thing successfully and even includes a localised £ sign which. Does this help shed any further light on it? Something in the including mechanism which is messing things up? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:10 AM Subject: Re: Currency Formatting That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM
RE: Currency Formatting
Ooo, didn't know I could use an iterator like that, I have always defined the var. Thanks for the tip, however do you not find that other way easier for readability? Just thinking an outsider might be left wondering where price came from.. Maybe I am missing the point. -Original Message- From: Chris Pratt [mailto:thechrispr...@gmail.com] Sent: 13 July 2010 23:28 To: Struts Users Mailing List Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
On further digging I have found out some more info. My action is /shop/getProduct.action?productId=61 The action is defined as follows: action name=getProduct class=org.chrismiles.sentiments.struts2.shop.GetProductAction result name=success/shop.jsp?content=/jsp/shopview/getProduct.jsp/result /action shop.jsp is basically main template page in which the content changes inside. It contains the following line s:include value=%{#parameters.content}/ So no matter what action I call I can forward to the shop page as the view and include the custom view page which in the above example is the getProduct jsp page. For testing I just used the following action result to go straight to the individual view page. result name=success/jsp/shopview/getProduct.jsp/result which includes s:text name=format.currencys:param value=product.price//s:text/span and it renders every thing successfully and even includes a localised £ sign which. Does this help shed any further light on it? Something in the including mechanism which is messing things up? Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:10 AM Subject: Re: Currency Formatting That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where
Re: Currency Formatting
At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e
Re: Currency Formatting
Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional
Re: Currency Formatting
HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris
Re: Currency Formatting
That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, July 11, 2010 1:25 AM Subject: Re: Currency Formatting Define something like: format.currency={0,number,currency
Re: Currency Formatting
Yeah I was hoping I did not need to. Not at midnight though. Will look tomorrow now haha. Thanks very much for the help. Chrid - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:10 AM Subject: Re: Currency Formatting That's weird I've never experienced anything like that were rendering stops without putting anything into the logs. Looks like you'll have to dig into the code. (*Chris*) On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote: HTML rendering just completely stops at that point. I get the following: span class=product-nameThis is a product name/span span class=product-price And nothing else for the rest of the page. Nothing in the logs. Nothing :) Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 12:03 AM Subject: Re: Currency Formatting Define fails, you get a stack trace? you don't get the output you expected? If so, what were you expecting vs. what did you get? I've used that code a thousand times, so I'm not sure what could be going wrong... (*Chris*) On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote: Thanks Chris. The reason I use this method in my iterators is there are a few places where I use nested iterators so the # notation is the only way to access the current iterator but also the parent iterator. This specific iterator is not nested so I have changed it for learning and trial sake and it fails with the line span class=product-prices:text name=format.currencys:param value=price//s:text/span I can put span class=product-prices:property value=price//span and it displays the value fine. Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:28 PM Subject: Re: Currency Formatting I've never used the iterator tag like that, the standard way to use the Struts 2 Iterator would be: s:iterator value=products span class=product-names:property value=name http://product.name/ //span span class=product-pricepound;s:text name=format.currencys:param value=price//s:text/span /s:iterator Since the iterator tag puts the current value on the top of the stack, there's no reason to define a variable to hold it. It's much simpler to just use the value stack to pull the values from. Don't know if this might help or not. (*Chris*) On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote: Chris, I have a list of products which contain a double price. I now have. s:iterator value=products var=product span class=product-names:property value=#product.name//span span class=product-pricepound;s:text name=format.currencys:param value=#product.price//s:text/span /s:iterator Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 11:04 PM Subject: Re: Currency Formatting s:iterator puts the value on the top of the stack, so if you have a list of doubles, we'll call it amounts, it would look something like this: s:iterator value=%{amounts} s:text name=format.currencys:param value=%{top}//s:text /s:iterator (*Chris*) On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote: Chris, Hi that works perfectly for s:text name=format.currencys:param value=total//s:text where total is public Double getTotal but causes all rendering to stop at the following within an iterator. s:text name=format.currencys:param value=#product.price/ where ListProduct getProducts (for the iterator), public Product getProduct and public Double getPrice and also fails just on s:text name=format.currencys:param value=product.price//s:text where public Product getProduct Is there places where different mechanisms need to be used here? I dont understand the inconstistant result I now get. Nothing in the log files on TRACE Thanks Chris - Original Message - From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 8:16 PM Subject: Re: Currency Formatting try s:param instead of s:property. (*Chris*) On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote: At the moment I have in my struts.xml constant name=struts.custom.i18n.resources value=ApplicationResources / ApplicationResources.properties is being packaged within WEB-INF\classes within a WAR within an EAR. The file contains: format.currency={0,number,currency} In my JSP I have s:text name=format.currencys:property value=product.price//s:text Without the s:text the price is displayed (a Double). When the s:text is included all I get is: {0} thanks Chris - Original Message
Currency Formatting
Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris
Re: Currency Formatting
Define something like: format.currency={0,number,currency} In your applications.properties file, then use: s:text name=format.currencys:param value=%{amount}//s:text HTH (*Chris*) On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote: Hi If I am displaying a Double to a JSP page what is the recommended way to format this is as a currency to two decimal points? Thanks Chris
Currency Formatting
I had defined in my applicationMessages.properties a currency string format as follows: format.currency={0,number,currency} When I view things in our default locale (English), this displays our currency values like 53.68; however when I view them in German I see 53,68 ?. Why does it show the question mark and how can I resolve this problem? Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Currency Formatting
If I had to make a guess, I'd say the font you're using doesn't support the Euro symbol. But, that's just a guess. (*Chris*) On Tuesday, March 9, 2010, CRANFORD, CHRIS chris.cranf...@setech.com wrote: I had defined in my applicationMessages.properties a currency string format as follows: format.currency={0,number,currency} When I view things in our default locale (English), this displays our currency values like 53.68; however when I view them in German I see 53,68 ?. Why does it show the question mark and how can I resolve this problem? Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Currency Formatting
My CSS was using: font-family: Verdana, Arial, Helvetica, sans-serif; I updated this to the following and rechecked it, same result: font-family: Arial, sans-serif; So I'm really confused at this point. Someone mentioned encoding before, but the pages are UTF-8, fonts appear not to be the issue yet my cost fields are being printed as 3,90 ? Any other thoughts? -Original Message- From: Chris Pratt [mailto:thechrispr...@gmail.com] Sent: Tuesday, March 09, 2010 10:23 AM To: Struts Users Mailing List Subject: Re: Currency Formatting If I had to make a guess, I'd say the font you're using doesn't support the Euro symbol. But, that's just a guess. (*Chris*) On Tuesday, March 9, 2010, CRANFORD, CHRIS chris.cranf...@setech.com wrote: I had defined in my applicationMessages.properties a currency string format as follows: format.currency={0,number,currency} When I view things in our default locale (English), this displays our currency values like 53.68; however when I view them in German I see 53,68 ?. Why does it show the question mark and how can I resolve this problem? Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Currency Formatting
I needed to specify my encoding in a filter inside web.xml. Once I did that, it resolved the issue. Thanks Chris -Original Message- From: Chris Pratt [mailto:thechrispr...@gmail.com] Sent: Tuesday, March 09, 2010 10:23 AM To: Struts Users Mailing List Subject: Re: Currency Formatting If I had to make a guess, I'd say the font you're using doesn't support the Euro symbol. But, that's just a guess. (*Chris*) On Tuesday, March 9, 2010, CRANFORD, CHRIS chris.cranf...@setech.com wrote: I had defined in my applicationMessages.properties a currency string format as follows: format.currency={0,number,currency} When I view things in our default locale (English), this displays our currency values like 53.68; however when I view them in German I see 53,68 ?. Why does it show the question mark and how can I resolve this problem? Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org