Class ServletWriter
java.lang.Object
org.apache.jasper.compiler.ServletWriter
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
NewlineReductionServletWriter
This is what is used to generate servlets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying writer.intReturns the current Java line number.voidDecreases the indentation level.voidprint(char c) Prints the given char.voidprint(int i) Prints the given int.voidPrints the given string.voidPrints the current indentation, and then the string, and a '\n'.voidprintin()Prints the current indentationvoidPrints the current indentation, followed by the given stringvoidprintln()Prints a '\n'voidPrints the given string followed by '\n'voidPrints the given string.voidIncreases the indentation level.
-
Constructor Details
-
ServletWriter
Creates a new ServletWriter.- Parameters:
writer- the underlying PrintWriter
-
-
Method Details
-
close
-
getJavaLine
public int getJavaLine()Returns the current Java line number.- Returns:
- the current line number
-
pushIndent
public void pushIndent()Increases the indentation level. -
popIndent
public void popIndent()Decreases the indentation level. -
println
-
println
public void println()Prints a '\n' -
printin
public void printin()Prints the current indentation -
printin
Prints the current indentation, followed by the given string- Parameters:
s- The string
-
printil
Prints the current indentation, and then the string, and a '\n'.- Parameters:
s- The string
-
print
public void print(char c) Prints the given char. Use println() to print a '\n'.- Parameters:
c- The char
-
print
public void print(int i) Prints the given int.- Parameters:
i- The int
-
print
Prints the given string. The string must not contain any '\n', otherwise the line count will be off.- Parameters:
s- The string
-
printMultiLn
Prints the given string. If the string spans multiple lines, the line count will be adjusted accordingly.- Parameters:
s- The string
-