public void writeHtml ( JspWriter pOut , String pHtml ) throws IOException { StringTokenizer parser = new StringTokenizer ( pHtml , "<>&" , true ) ; while ( parser . hasMoreTokens ( ) ) { String token = parser . nextToken ( ) ; if ( token . equals ( "<" ) ) { pOut . print ( "&lt;" ) ; } else if ( token . equals ( ">" ) ) { pOut . print ( "&gt;" ) ; } else if ( token . equals ( "&" ) ) { pOut . print ( "&amp;" ) ; } else { pOut . print ( token ) ; } } }
writeHtml ensures that the text being outputted appears as it was entered . This prevents users from hacking the system by entering html or jsp code into an entry form where that value will be displayed later in the site .