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.currency"><s: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-name">This 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-price"><s:text name="format.currency"><s:param
value="price"/></s:text></span>
I can put
<span class="product-price"><s: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-name"><s:property value="name <
http://product.name/
>
"/></span>
<span class="product-price">£<s:text
name="format.currency"><s: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-name"><s:property
value="#product.name"/></span>
<span class="product-price">£<s:text
name="format.currency"><s: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.currency"><s: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.currency"><s: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.currency"><s:param value="#product.price"/>
where List<Product> getProducts (for the iterator), public Product
getProduct and public Double getPrice
and also fails just on
<s:text name="format.currency"><s: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.currency"><s: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.currency"><s: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
---------------------------------------------------------------------
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