shinynewbike
shinynewbike

Reputation: 2352

Replace Struts TagUtils in Spring-mvc

I have some custom code using Struts library which we are porting to Spring MVC

I need to replace

org.apache.struts.taglib.TagUtils.getInstance().write(pageContext, value);

but cant find the way to do this without using Struts TagUtils.

any ideas using Spring or any other open source library?

Upvotes: 1

Views: 1324

Answers (1)

JB Nizet
JB Nizet

Reputation: 692081

The source code of this method is

JspWriter writer = pageContext.getOut();
try {
    writer.print(text);
} 
catch (IOException e) {
    TagUtils.getInstance().saveException(pageContext, e);
    throw new JspException(messages.getMessage("write.io", e.toString()));
}

In short, it writes to the JspWriter, and transforms an IOException into a JspException.

This shouldn't be too hard to reimplement by yourself.

Upvotes: 2

Related Questions