• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger
  • Frits Walraven

JSTL question - format tag library

Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been researching JSTL and found a very informative article from JavaWorld:
In the Format Tag library: format actions section, it says:

In this example, we go the other way�we start with a text string containing a formatted (currency, per the type attribute) field in the value attribute and parse it to obtain a number. The result is typically stored in a variable specified by the var attribute. Although this attribute is optional, you will usually use it; otherwise, the parsed value is simply sent to the page output:
<fmt arseNumber value="${currencyInput}" type="currency" var="parsedNumber"/>

In the bold sentence above, does this mean when a var="[variableName]" is used that the value is ONLY saved to the variable and not output? OR does it mean that the value is saved to the variable in addition to being output? The <c ut> tag is not listed.
Furthermore, on the same page, the <fmt:formatDate> tag is discussed. It says that the format class that handles the formatting is typically java.util.Date. I use GregorianCalendars throughout my applications. How do I customize this tag to get and set values in a GregorianCalendar?
Thanks in advance for your help.
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use the var attribute, the value of the action will be stored into the variable only. It will default to a page scope variable.You can change the scope by also using the optional scope attribute.
FYI, there are samples of all of the JSTL action in use in the free download that accompanies my book, 'JSTL: Practical Guide for JSP Programmers'
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic