JSP Custim tag problem please help

Discussions

Web tier: servlets, JSP, Web frameworks: JSP Custim tag problem please help

  1. JSP Custim tag problem please help (1 messages)

    Hi everyone I am using a simple custom jsp tag to take a peice of text and reformmat it into utf8. The tag works when the text is less than about 3400 characters however if the body length exceeds this then it fails to work. the System out however still displays the properly formmated text.
    I can't use mutiple tags between the text as i am using another tag to include the text into my document. Any help would really be appreeciated.
    Jeff Anderson
    janderso at organic dot com

    the tag implements the the bodytagsupport interface. the tag is as follows.


    <utf8:encode>
    text here
    </utf8:encode>


    The code is as follows


    public class UTF8Tag extends BodyTagSupport{

      public int doAfterBody() throws JspException{

                      try{
                        BodyContent body =getBodyContent();
      String baseString=body.getString()
                        body.clearBody();
      body.clearBody();

                        String UTF8String=new String(baseString.getBytes(),"UTF-8");
      getPreviousOut().print(UTF8String);

                        //debug code
                        System.out.println(UTF8String);
                        System.out.println("UTF PRINTED");

      }

      catch(Exception e){
                             System.out.println(e.toString());
                            System.out.println("exception");
      throw new JspTagException("io error");
      }
      return SKIP_BODY;
      }
     }

  2. This may be a shot in the dark Jeff, but could this be a buffering issue on the output? Does it display up to the 3400 or none at all if it exceeds that length?

    Robert