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.currency"><s: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.currency"><s: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.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 >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >