开发者

JSF 1.1 - embedding HTML in h:messages

I'm facing a similar issue as this one : Embedding a link (or other html) in a JSF message

I want to embed an anchor tag in h:messages. This solution mentioned will work with JSF 1.2. But I'm stuck with JSF 1.1 on my project. ResponseWriterWrapper is not available for 1.2. Any way a开发者_运维百科round this?

@BalusC - Thanks for all ur posts across the web :)


Just create your own ResponseWriterWrapper class.

public abstract class ResponseWriterWrapper extends ResponseWriter {

    public abstract ResponseWriter getWrapped();

    @Override
    public String getContentType() {
        return getWrapped().getContentType();
    }

    @Override
    public String getCharacterEncoding() {
        return getWrapped().getCharacterEncoding();
    }

    @Override
    public void flush() throws IOException {
        getWrapped().flush();
    }

    @Override
    public void startDocument() throws IOException {
        getWrapped().startDocument();
    }

    // Etc... Just override all abstract methods of ResponseWriter 
    // and delegate the call to getWrapped(). There are 15 of them.
}

It's basically a convenience class so that you don't need to implement all of 15 abstract methods whenever you need only one or two of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜