blob: e1a1e0c32fa28d8a6bac03121a4f3944127b8242 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_02) on Mon Nov 26 08:08:47 PST 2007 -->
<TITLE>
ViewResourceTool (VelocityTools 1.4 Documentation)
</TITLE>
<META NAME="keywords" CONTENT="org.apache.velocity.tools.view.tools.ViewResourceTool class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="ViewResourceTool (VelocityTools 1.4 Documentation)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/apache/velocity/tools/view/tools/ViewRenderTool.html" title="class in org.apache.velocity.tools.view.tools"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/velocity/tools/view/tools/ViewTool.html" title="interface in org.apache.velocity.tools.view.tools"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/velocity/tools/view/tools/ViewResourceTool.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ViewResourceTool.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;<A HREF="#nested_classes_inherited_from_class_org.apache.velocity.tools.generic.ResourceTool">NESTED</A>&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_org.apache.velocity.tools.generic.ResourceTool">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.velocity.tools.view.tools</FONT>
<BR>
Class ViewResourceTool</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html" title="class in org.apache.velocity.tools.generic">org.apache.velocity.tools.generic.ResourceTool</A>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.velocity.tools.view.tools.ViewResourceTool</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>ViewResourceTool</B><DT>extends <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html" title="class in org.apache.velocity.tools.generic">ResourceTool</A></DL>
</PRE>
<P>
<p>Tool for accessing ResourceBundles and formatting messages therein.</p>
<p><pre>
Template example(s):
$text.foo -> bar
$text.hello.world -> Hello World!
#set( $otherText = $text.bundle('otherBundle') )
$otherText.foo -> woogie
$otherText.bar -> The args are {0} and {1}.
$otherText.bar.insert(4) -> The args are 4 and {1}.
$otherText.bar.insert(4,true) -> The args are 4 and true.
Toolbox configuration example:
&lt;tool&gt;
&lt;key&gt;text&lt;/key&gt;
&lt;class&gt;org.apache.velocity.tools.view.tools.ViewResourceTool&lt;/class&gt;
&lt;parameter name="bundles" value="resources,com.foo.moreResources"/&gt;
&lt;/tool&gt;
</pre></p>
<p>This comes in very handy when internationalizing templates.
Note that the default resource bundle baseName is "resources", and
the default locale is the result of HttpServletRequest.getLocale().
The default bundle baseName can be overridden as shown above.
</p>
<p>Also, be aware that very few performance considerations have been made
in this initial version. It should do fine, but if you have performance
issues, please report them to dev@velocity.apache.org, so we can make
improvements.
</p>
<p>This tool is NOT meant to be used in either application or
session scopes of a servlet environment.</p>
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>VelocityTools 1.3</DD>
<DT><B>Version:</B></DT>
<DD>$Revision: 497990 $ $Date: 2006-11-27 10:49:37 -0800 (Mon, 27 Nov 2006) $</DD>
<DT><B>Author:</B></DT>
<DD>Nathan Bubna</DD>
</DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
&nbsp;<A NAME="nested_classes_inherited_from_class_org.apache.velocity.tools.generic.ResourceTool"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class org.apache.velocity.tools.generic.<A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html" title="class in org.apache.velocity.tools.generic">ResourceTool</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.Key.html" title="class in org.apache.velocity.tools.generic">ResourceTool.Key</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_org.apache.velocity.tools.generic.ResourceTool"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class org.apache.velocity.tools.generic.<A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html" title="class in org.apache.velocity.tools.generic">ResourceTool</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#BUNDLES_KEY">BUNDLES_KEY</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#LOCALE_KEY">LOCALE_KEY</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/velocity/tools/view/tools/ViewResourceTool.html#ViewResourceTool()">ViewResourceTool</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/velocity/tools/view/tools/ViewResourceTool.html#init(java.lang.Object)">init</A></B>(java.lang.Object&nbsp;obj)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initializes this instance.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_org.apache.velocity.tools.generic.ResourceTool"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class org.apache.velocity.tools.generic.<A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html" title="class in org.apache.velocity.tools.generic">ResourceTool</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#bundle(java.lang.String)">bundle</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#configure(java.util.Map)">configure</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#get(java.lang.String)">get</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#get(java.lang.String, java.lang.String[], java.util.Locale)">get</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#get(java.lang.String, java.lang.String, java.util.Locale)">get</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#getDefaultBundle()">getDefaultBundle</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#getDefaultLocale()">getDefaultLocale</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#insert(java.util.List)">insert</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#insert(java.lang.Object)">insert</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#insert(java.lang.Object[])">insert</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#insert(java.lang.Object, java.lang.Object)">insert</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#locale(java.util.Locale)">locale</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#render(java.lang.Object, java.lang.Object[])">render</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#setDefaultBundle(java.lang.String)">setDefaultBundle</A>, <A HREF="../../../../../../org/apache/velocity/tools/generic/ResourceTool.html#setDefaultLocale(java.util.Locale)">setDefaultLocale</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ViewResourceTool()"><!-- --></A><H3>
ViewResourceTool</H3>
<PRE>
public <B>ViewResourceTool</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="init(java.lang.Object)"><!-- --></A><H3>
init</H3>
<PRE>
public void <B>init</B>(java.lang.Object&nbsp;obj)</PRE>
<DL>
<DD>Initializes this instance.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the current ViewContext</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/apache/velocity/tools/view/tools/ViewRenderTool.html" title="class in org.apache.velocity.tools.view.tools"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/velocity/tools/view/tools/ViewTool.html" title="interface in org.apache.velocity.tools.view.tools"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/velocity/tools/view/tools/ViewResourceTool.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ViewResourceTool.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;<A HREF="#nested_classes_inherited_from_class_org.apache.velocity.tools.generic.ResourceTool">NESTED</A>&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_org.apache.velocity.tools.generic.ResourceTool">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright (c) 2003-2007 Apache Software Foundation
</BODY>
</HTML>