This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JSTL question - format tag library  RSS feed

 
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:
http://www.javaworld.com/javaworld/jw-02-2003/jw-0228-jstl_p.html
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.
 
Author
Ranch Hand
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'
HTH
Sue
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!