BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.html
Class StringElement

java.lang.Object
  |
  +--weblogic.html.HtmlElement
        |
        +--weblogic.html.StringElement

public class StringElement
extends HtmlElement

A StringElement is used to add String objects to an HtmlPage. A StringElement may be a dbKona Record object that is part of a DataSet retrieved in a database query. Any arbitrary HtmlElement can be returned as a String with the HtmlElement.toString() method.

Version:
2.1
Author:
Copyright (c) 1995-1998 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1998-1999 by BEA Systems, Inc. All Rights Reserved.
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.
See Also:
Record, HtmlElement.toString(java.lang.String)

Field Summary
protected  java.lang.String contents
           
 
Fields inherited from class weblogic.html.HtmlElement
codeset, useObsolete
 
Constructor Summary
StringElement()
          Constructs a StringElement.
StringElement(HtmlElement val)
          Constructs a StringElement with the specified HtmlElement.
StringElement(Record rec)
          Constructs a StringElement with the specified Record from a DataSet.
StringElement(Record rec, int[] maxwidths)
          Constructs a StringElement with the specified Record from a DataSet.
StringElement(java.lang.String val)
          Constructs a StringElement with the specified String.
 
Method Summary
 StringElement escape()
          Escapes a StringElement using HTML entities.
 void output(java.io.OutputStream out)
          Outputs to the specified OutputStream.
 void output(java.io.OutputStream out, java.lang.String codeset)
          Outputs to the specified OutputStream.
 void output(java.io.PrintWriter pw)
           
 StringElement replace(java.lang.String oldstr, HtmlElement elem)
          Replaces a string in a StringElement with the string representation of an HtmlElement.
 StringElement replace(java.lang.String oldstr, java.lang.String newstr)
          Replaces a string with a new string in a StringElement.
 StringElement replaceWithElement(java.lang.String oldstr, java.lang.String classname)
          Replaces a string in a StringElement with a SinglePartElement or one of its subclasses specified by the classname.
 StringElement setContents(java.lang.String val)
          Sets the contents of a StringElement to the specified value.
 StringElement setContentsWithFile(java.lang.String filename)
          Sets the contents of a StringElement to the contents of the specified filename.
 int widthAsLiteral()
          Returns the number of characters in a StringElement.
 
Methods inherited from class weblogic.html.HtmlElement
asAnchorElement, asBigElement, asBlockquoteElement, asBoldElement, asCenteredElement, asCiteElement, asCodeElement, asCommentElement, asDefineTermElement, asEmphasisElement, asFontElement, asFontElement, asFontElement, asHtmlContainer, asItalicElement, asKeyboardElement, asLiteralElement, asParagraphElement, asSampleElement, asSmallElement, asStrikeElement, asStrongElement, asSubscriptElement, asSuperscriptElement, asTeletypeElement, asUnderlineElement, asVariableElement, getVersion, setAnchorMode, setCodeset, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contents

protected java.lang.String contents
Constructor Detail

StringElement

public StringElement()
Constructs a StringElement.

StringElement

public StringElement(java.lang.String val)
Constructs a StringElement with the specified String.

Parameters:
val - String object

StringElement

public StringElement(HtmlElement val)
Constructs a StringElement with the specified HtmlElement.

Parameters:
val - HtmlElement object

StringElement

public StringElement(Record rec,
                     int[] maxwidths)
              throws java.sql.SQLException,
                     DataSetException,
                     java.io.IOException
Constructs a StringElement with the specified Record from a DataSet.

Parameters:
val - HtmlElement object
Throws:
java.sql.SQLException - if there is a SQL error
DataSetException - if there is an error with the DataSet
java.io.IOException - if there is an IO error

StringElement

public StringElement(Record rec)
              throws java.sql.SQLException,
                     DataSetException,
                     java.io.IOException
Constructs a StringElement with the specified Record from a DataSet.

Parameters:
val - HtmlElement object
Throws:
java.sql.SQLException - if there is a SQL error
DataSetException - if there is an error with the DataSet
java.io.IOException - if there is an IO error
Method Detail

replaceWithElement

public StringElement replaceWithElement(java.lang.String oldstr,
                                        java.lang.String classname)
                                 throws HtmlException
Replaces a string in a StringElement with a SinglePartElement or one of its subclasses specified by the classname.

Parameters:
oldstr - String to replace
classname - Classname of the SinglePartElement
Returns:
StringElement
Throws:
HtmlException - if the new class name is not subclassed from SinglePartElement

replace

public StringElement replace(java.lang.String oldstr,
                             HtmlElement elem)
                      throws java.io.IOException
Replaces a string in a StringElement with the string representation of an HtmlElement.

Parameters:
oldstr - String to replace
elem - HtmlElement object
Returns:
StringElement object
Throws:
java.io.IOException - if there is an IO error

replace

public StringElement replace(java.lang.String oldstr,
                             java.lang.String newstr)
                      throws java.io.IOException
Replaces a string with a new string in a StringElement.

Parameters:
oldstr - String to replace
newstr - MultiPartElement object
Returns:
StringElement object
Throws:
java.io.IOException - if there is an IO error

widthAsLiteral

public int widthAsLiteral()
Returns the number of characters in a StringElement.

Returns:
Width
Overrides:
widthAsLiteral in class HtmlElement

setContents

public StringElement setContents(java.lang.String val)
Sets the contents of a StringElement to the specified value.

Parameters:
val - String
Returns:
StringElement

setContentsWithFile

public StringElement setContentsWithFile(java.lang.String filename)
                                  throws HtmlException
Sets the contents of a StringElement to the contents of the specified filename.

Parameters:
filename - Filename enclosed in double quotes
Returns:
StringElement
Throws:
HtmlException - if the contents cannot be set

output

public void output(java.io.OutputStream out)
            throws java.io.IOException
Outputs to the specified OutputStream.

Parameters:
ostr - Output stream
Throws:
java.io.IOException - if there is an IO error
Overrides:
output in class HtmlElement

output

public void output(java.io.OutputStream out,
                   java.lang.String codeset)
            throws java.io.IOException
Outputs to the specified OutputStream.

Parameters:
ostr - Output stream
codeset - Java Codeset
Throws:
java.io.IOException - if there is an IO error
Overrides:
output in class HtmlElement

output

public void output(java.io.PrintWriter pw)
            throws java.io.IOException

Overrides:
output in class HtmlElement

escape

public StringElement escape()
Escapes a StringElement using HTML entities. For example, "&" is returned as "&".

Returns:
StringElement

Documentation is available at
http://www.weblogic.com/docs51