Added StringTool for doing simple string stuff from within a template

(presently just checking if a string is blank).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@572 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2002-02-10 05:06:09 +00:00
parent a37f5aca61
commit c0b818b539
2 changed files with 48 additions and 7 deletions
@@ -1,5 +1,5 @@
//
// $Id: DispatcherServlet.java,v 1.14 2002/01/24 06:32:38 mdb Exp $
// $Id: DispatcherServlet.java,v 1.15 2002/02/10 05:06:08 mdb Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -262,6 +262,10 @@ public class DispatcherServlet extends VelocityServlet
FormTool form = new FormTool(req);
ictx.put(FORMTOOL_KEY, form);
// create a new string tool for use by the template
StringTool string = new StringTool();
ictx.put(STRINGTOOL_KEY, string);
// resolve the appropriate logic class for this URI and
// execute it if it exists
String path = req.getServletPath();
@@ -396,16 +400,16 @@ public class DispatcherServlet extends VelocityServlet
*/
protected static final String APPLICATION_KEY = "%_app_%";
/**
* This is the key used to store the message resolver in the context.
*/
/** This is the key used to store the message resolver in the
* context. */
protected static final String MSGRESOLVER_KEY = "i18n";
/**
* This is the key used to store the form tool in the context.
*/
/** This is the key used to store the form tool in the context. */
protected static final String FORMTOOL_KEY = "form";
/** This is the key used to store the string tool in the context. */
protected static final String STRINGTOOL_KEY = "string";
/** The servlet parameter key specifying the application class. */
protected static final String APP_CLASS_KEY = "app_class";
@@ -0,0 +1,37 @@
//
// $Id: StringTool.java,v 1.1 2002/02/10 05:06:09 mdb Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.samskivert.velocity;
import com.samskivert.util.StringUtil;
/**
* Provides simple string funtions like <code>blank()</code>.
*/
public class StringTool
{
/**
* Returns true if the supplied string is blank, false if not.
*/
public boolean blank (String text)
{
return StringUtil.blank(text);
}
}