com.bowstreet.webapp.util
Class JSPUtils

java.lang.Object
  extended by com.bowstreet.webapp.util.JSPUtils

public class JSPUtils
extends java.lang.Object

Utility methods for manipulating JSP code in WebSphere Portlet Factory pages.


Constructor Summary
JSPUtils()
           
 
Method Summary
static void addContentToPageHeader(Page page, java.lang.String content)
          Adds some content at top of page
static void addImportsDirective(Page page, java.lang.String packageName)
          Add an imports directive to top of page, if it's not already there
static void addScriptReference(Page page, java.lang.String url)
          Add a JavaScript reference to the given page.
static void addStylesheet(Page page, java.lang.String url)
          Add a stylesheet reference to the given page.
static void addTagLibCall(Page page, IXml element, java.lang.String uri, java.lang.String prefix, IXml tag)
          Add a tag library call, including the taglib directive, to the specified element.
static void addTagLibCall(Page page, IXml element, java.lang.String uri, java.lang.String prefix, IXml tag, boolean replaceNode)
          Add a tag library call, including the taglib directive.
static void addTagLibDirective(Page page, java.lang.String uri, java.lang.String prefix)
          Add the specified taglib reference to the header of the specified page.
static IXml getPageHeaderContent(Page page)
          Gets HTMLContent element where we'll insert page header tags (e.g. imports, taglib)
static java.lang.String getUniqueJavaIdentifier(Page page, java.lang.String base)
          Get a unique Java variable/method name, using the given base name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSPUtils

public JSPUtils()
Method Detail

addContentToPageHeader

public static void addContentToPageHeader(Page page,
                                          java.lang.String content)
Adds some content at top of page

Parameters:
page -
content -

addImportsDirective

public static void addImportsDirective(Page page,
                                       java.lang.String packageName)
Add an imports directive to top of page, if it's not already there

Parameters:
page -
packageName - package name to import

addScriptReference

public static void addScriptReference(Page page,
                                      java.lang.String url)
Add a JavaScript reference to the given page.

Parameters:
page - the WebApp page into which this identifier will be put
url - potentially indirect reference specifying JavaScript source URL

addStylesheet

public static void addStylesheet(Page page,
                                 java.lang.String url)
Add a stylesheet reference to the given page.

Parameters:
page - the WebApp page into which this identifier will be put
url - potentially indirect reference specifying style sheet URL

addTagLibCall

public static void addTagLibCall(Page page,
                                 IXml element,
                                 java.lang.String uri,
                                 java.lang.String prefix,
                                 IXml tag)
Add a tag library call, including the taglib directive, to the specified element. Adds as last child of "element".

Parameters:
page - Page
element - element to add the taglib reference as a child of.
uri - URI
prefix - prefix
tag - tag

addTagLibCall

public static void addTagLibCall(Page page,
                                 IXml element,
                                 java.lang.String uri,
                                 java.lang.String prefix,
                                 IXml tag,
                                 boolean replaceNode)
Add a tag library call, including the taglib directive. Either adds as last child of "element", or replaces element, depending on replaceNode value.

Parameters:
page - Page
element - element to add the taglib reference as a child of.
uri - URI
prefix - prefix
tag - tag
replaceNode - boolean, specifying whether to replace the specified element or add a child node to it.

addTagLibDirective

public static void addTagLibDirective(Page page,
                                      java.lang.String uri,
                                      java.lang.String prefix)
Add the specified taglib reference to the header of the specified page.

Parameters:
page -
uri -
prefix -

getPageHeaderContent

public static IXml getPageHeaderContent(Page page)
Gets HTMLContent element where we'll insert page header tags (e.g. imports, taglib)

Parameters:
page -
Returns:
IXml representation of the page header contents

getUniqueJavaIdentifier

public static java.lang.String getUniqueJavaIdentifier(Page page,
                                                       java.lang.String base)
Get a unique Java variable/method name, using the given base name.

Parameters:
page - the WebApp page into which this identifier will be put
base - string used as name or as base of name
Returns:
name which can be used without collisions with other users of this method - either base or base plus an integer


Copyright © 2009 IBM. All Rights Reserved.