jp.terasoluna.fw.web.taglib
Class TagUtil

java.lang.Object
  extended by jp.terasoluna.fw.web.taglib.TagUtil

public class TagUtil
extends java.lang.Object

Utility class convering all custom tag functions.


Field Summary
private static java.util.Map<java.lang.String,java.lang.Integer> SCOPES
          Scope map.
 
Constructor Summary
TagUtil()
           
 
Method Summary
static java.lang.String filter(java.lang.String value)
          Performs sanitization when HTML is output. Replaces "<", ">", "&", ", "'".
static int getScope(java.lang.String scopeName)
          Returns the scope constant that matches with scope name of argument. Generates exception when the matching scope does not exist.
static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, java.lang.String scopeName)
          Fetches the Bean from the specified scope. Fetches the bean from the PageScope when the scopeName argument is Null.
static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, java.lang.String property, java.lang.String scopeName)
          Fetches the Bean and fetches the property value from that Bean which is specified as argument. Returns the fetched bean when the property argument is Null. Generates the exception when unable to fetch the Bean.
static void write(javax.servlet.jsp.PageContext pageContext, java.lang.String text)
          Fetches JspWriter from PageContext and outputs the specified text. Version without linefeed.
static void writeln(javax.servlet.jsp.PageContext pageContext, java.lang.String text)
          Fetches JspWriter from PageContext and outputs the specified text. Version with linefeed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPES

private static final java.util.Map<java.lang.String,java.lang.Integer> SCOPES
Scope map.

Constructor Detail

TagUtil

public TagUtil()
Method Detail

getScope

public static int getScope(java.lang.String scopeName)
                    throws javax.servlet.jsp.JspException
Returns the scope constant that matches with scope name argument. Generates exception when the matching scope does not exist.

Parameters:
scopeName - Scope name of constant to be fetched
Returns:
Constant of scope which is fetched
Throws:
javax.servlet.jsp.JspException - When the matching scope does not exist

lookup

public static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext,
                                      java.lang.String name,
                                      java.lang.String scopeName)
                               throws javax.servlet.jsp.JspException
Fetches the Bean from the specified scope. Fetches the Bean from PageScope when the scopeName argument is scopeName Null.

Parameters:
pageContext - Page context
name - Bean name to be fetched
scopeName - Scope name that fetches Bean.
Returns:
Bean which is fetched
Throws:
javax.servlet.jsp.JspException - When the matching scope does not exist

lookup

public static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext,
                                      java.lang.String name,
                                      java.lang.String property,
                                      java.lang.String scopeName)
                               throws javax.servlet.jsp.JspException
Fetches the Bean and fetches the property name which is specified as argument from that Bean. Returns the fetched Bean when the property argument is Null. Generates exception when unable to fetch the Bean.

Parameters:
pageContext - Page context
name - Bean name to be fetched
property - Property name of Bean
scopeName - Scope name that fetches Bean
Returns:
Fetched Bean
Throws:
javax.servlet.jsp.JspException - When the matching scope does not exist, When the specified Bean does not exist

write

public static void write(javax.servlet.jsp.PageContext pageContext,
                         java.lang.String text)
                  throws javax.servlet.jsp.JspException
Fetches JspWriter from PageContext and outputs the specified text. Version without linefeed.

Parameters:
pageContext - Page context
text - Text to be output
Throws:
javax.servlet.jsp.JspException - Exception that wraps IOException when I/O error occurs

writeln

public static void writeln(javax.servlet.jsp.PageContext pageContext,
                           java.lang.String text)
                    throws javax.servlet.jsp.JspException
Fetches JspWriter from PageContext and outputs the specified text. Version with linefeed.

Parameters:
pageContext - Page context
text - Text to be output
Throws:
javax.servlet.jsp.JspException - Exception that wraps IOException when I/O error occurs

filter

public static java.lang.String filter(java.lang.String value)
Performs the sanitization when HTML is output. Replaces "<", ">", "&", ", "'".

Parameters:
value - String to be sanitized
Returns:
Edited string