Obviously, I don't understand how to create, instantiate, or implement a 
formatter. Here's what I tried.

I created HTMLLineBreakReformatter.java as:

package com.as.utils;

import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;

@SuppressWarnings("serial")
public class HTMLLineBreakReformatter extends Format {

        @Override
        public StringBuffer format(Object object, StringBuffer buffer, 
FieldPosition pos) {
                return buffer.append(((String)object).replaceAll("\n", "<BR 
/>"));
                
        }

        @Override
        public Object parseObject(String source, ParsePosition pos) {
                
                return null;
        }

}

Then I imported it into my java for the page:

public HTMLLineBreakReformatter hTMLFormtter;

and in the constructor for the page's java:

public UserMain(WOContext context) {
    super(context);
    
    hTMLFormtter = new HTMLLineBreakReformatter();
}


then in the WOString in question:

<wo:WOString  formatter = "$hTMLFormtter" value = "$currentNote.noteText" />

the \n's are indeed replaced by <br /> and I see in the page in question:

I need to see the example here!!!<BR /><BR /><BR />and again<BR /><BR />and 
again<BR /><BR />and again!!!

the HTML page is not interpreting the <br /> as a new line which means I don't 
understand something.

I am running out of ideas to try. I should say I feel that I have run out of 
ideas.

Thanks for any help...

Ted



      
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to