This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL question - format tag library  RSS feed

 
verduka fox
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.
 
Sue Spielman
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!