You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Stephen Souness <so...@hotmail.com> on 2006/02/02 22:52:07 UTC

fmt:formatNumber not formatting on first page load

Hi,

Is it a known issue that the following JSTL will not format the provided 
value on the first loading of the JSP?

<fmt:formatNumber value="${someBean.price}" type="currency" 
currencySymbol="$" maxFractionDigits="0" />

Subsequent page refreshes seem to work fine.

Server is Tomcat 5.5.12
Java version is 1.5.0_06-b05

I think that I have had a client complain about something similar 
involving JSTL's fmt:formatDate under Tomcat 5.0, Java 1.4.2


--
Stephen


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: fmt:formatNumber not formatting on first page load

Posted by Stephen Souness <so...@hotmail.com>.
Looks like I posted too soon.

Re-starting Tomcat on the Linux server, and then reloading the page 
containing the JSTL produces our old friend the conspicuously 
non-formatted number.

Here's a snippet from my server.xml, in case anyone can find a glaring 
issue to explain what I have been observing:

<Host name="www.mystuffgoeshere.com" debug="9"
     appBase="/usr/local/webapps"
     unpackWARs="true" autoDeploy="true" xmlValidation="false"
     xmlNamespaceAware="false" reloadable="true"
     tcpListenAddress="192.168.1.77">
        <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
          driverName="net.sourceforge.jtds.jdbc.Driver"
          connectionName="NotTelling"
          connectionPassword="ASecret"
          connectionURL="jdbc:jtds:sqlserver://127.0.0.1/NotTelling
          userTable="LOGIN" userNameCol="USERNAME"
          userCredCol="PASSWORD"
          userRoleTable="LOGIN" roleNameCol="ROLE"/>
</Host>

Other aspects of my application:
- Using Tomcat's built-in security (hence JDBC Realm defined above)
- Using Struts 1.2.8
- Using Tiles


--
Stephen



Stephen Souness wrote:
> Windows XP Professional is the OS that this app has encountered this 
> issue on.
> 
> We'll be deploying it to a Linux box when it goes live, and my tests 
> today indicate that everything goes fine first time under Linux (for 
> that particular aspect at least - let's not tempt Murphy to invoke the 
> law).
> 
> 
> -- 
> Stephen
> 
> 
> 
> Rahul Akolkar wrote:
> 
>> On 2/2/06, Stephen Souness <so...@hotmail.com> wrote:
>>
>>> More info:
>>>
>>> - the value is a string along the lines of :
>>> 165000.0
>>>
>>> So what I would expect to happen is:
>>> - the decimal point and fractional 0 to be truncated
>>> - a '$' symbol to be pre-pended
>>> - a ',' between the '5' and the first '0' indicating thousands
>>>
>>> Each time Tomcat is restarted, the first load of the page shows:
>>>
>>> 165000.0
>>>
>>> subsequent page loads give the correct:
>>>
>>> $165,000
>>>
>>
>> <snip/>
>>
>> On Tomcat 5.0.28, JDK 1.4.2, JSTL 1.1, this JSP:
>>
>> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
>> <fmt:formatNumber value="165000.0" type="currency"
>>                   currencySymbol="$" maxFractionDigits="0" />
>>
>> give me this output:
>>
>> $165,000
>>
>> The first time, and every time beyond that. There's something else
>> going on in your setup. I can't say based on the information we have.
>>
>> -Rahul
>>
>>
>>
>>> -- 
>>> Stephen
>>>
>>
>> <snap/>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: fmt:formatNumber not formatting on first page load

Posted by Stephen Souness <so...@hotmail.com>.
Windows XP Professional is the OS that this app has encountered this 
issue on.

We'll be deploying it to a Linux box when it goes live, and my tests 
today indicate that everything goes fine first time under Linux (for 
that particular aspect at least - let's not tempt Murphy to invoke the law).


--
Stephen



Rahul Akolkar wrote:
> On 2/2/06, Stephen Souness <so...@hotmail.com> wrote:
> 
>>More info:
>>
>>- the value is a string along the lines of :
>>165000.0
>>
>>So what I would expect to happen is:
>> - the decimal point and fractional 0 to be truncated
>> - a '$' symbol to be pre-pended
>> - a ',' between the '5' and the first '0' indicating thousands
>>
>>Each time Tomcat is restarted, the first load of the page shows:
>>
>>165000.0
>>
>>subsequent page loads give the correct:
>>
>>$165,000
>>
> 
> <snip/>
> 
> On Tomcat 5.0.28, JDK 1.4.2, JSTL 1.1, this JSP:
> 
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
> <fmt:formatNumber value="165000.0" type="currency"
>                   currencySymbol="$" maxFractionDigits="0" />
> 
> give me this output:
> 
> $165,000
> 
> The first time, and every time beyond that. There's something else
> going on in your setup. I can't say based on the information we have.
> 
> -Rahul
> 
> 
> 
>>--
>>Stephen
>>
> 
> <snap/>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: fmt:formatNumber not formatting on first page load

Posted by Rahul Akolkar <ra...@gmail.com>.
On 2/2/06, Stephen Souness <so...@hotmail.com> wrote:
> More info:
>
> - the value is a string along the lines of :
> 165000.0
>
> So what I would expect to happen is:
>  - the decimal point and fractional 0 to be truncated
>  - a '$' symbol to be pre-pended
>  - a ',' between the '5' and the first '0' indicating thousands
>
> Each time Tomcat is restarted, the first load of the page shows:
>
> 165000.0
>
> subsequent page loads give the correct:
>
> $165,000
>
<snip/>

On Tomcat 5.0.28, JDK 1.4.2, JSTL 1.1, this JSP:

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:formatNumber value="165000.0" type="currency"
                  currencySymbol="$" maxFractionDigits="0" />

give me this output:

$165,000

The first time, and every time beyond that. There's something else
going on in your setup. I can't say based on the information we have.

-Rahul


>
> --
> Stephen
>
<snap/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: fmt:formatNumber not formatting on first page load

Posted by Stephen Souness <so...@hotmail.com>.
More info:

- the value is a string along the lines of :
165000.0

So what I would expect to happen is:
  - the decimal point and fractional 0 to be truncated
  - a '$' symbol to be pre-pended
  - a ',' between the '5' and the first '0' indicating thousands

Each time Tomcat is restarted, the first load of the page shows:

165000.0

subsequent page loads give the correct:

$165,000


--
Stephen



Rahul Akolkar wrote:
> On 2/2/06, Stephen Souness <so...@hotmail.com> wrote:
> 
>>Hi,
>>
>>Is it a known issue that the following JSTL will not format the provided
>>value on the first loading of the JSP?
>>
> 
> <snip/>
> 
> No. This shouldn't happen, I've used the format tags on similar setups.
> 
> -Rahul
> 
> 
> 
>><fmt:formatNumber value="${someBean.price}" type="currency"
>>currencySymbol="$" maxFractionDigits="0" />
>>
>>Subsequent page refreshes seem to work fine.
>>
>>Server is Tomcat 5.5.12
>>Java version is 1.5.0_06-b05
>>
>>I think that I have had a client complain about something similar
>>involving JSTL's fmt:formatDate under Tomcat 5.0, Java 1.4.2
>>
>>
>>--
>>Stephen
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: fmt:formatNumber not formatting on first page load

Posted by Rahul Akolkar <ra...@gmail.com>.
On 2/2/06, Stephen Souness <so...@hotmail.com> wrote:
> Hi,
>
> Is it a known issue that the following JSTL will not format the provided
> value on the first loading of the JSP?
>
<snip/>

No. This shouldn't happen, I've used the format tags on similar setups.

-Rahul


> <fmt:formatNumber value="${someBean.price}" type="currency"
> currencySymbol="$" maxFractionDigits="0" />
>
> Subsequent page refreshes seem to work fine.
>
> Server is Tomcat 5.5.12
> Java version is 1.5.0_06-b05
>
> I think that I have had a client complain about something similar
> involving JSTL's fmt:formatDate under Tomcat 5.0, Java 1.4.2
>
>
> --
> Stephen
>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org