My project was using older versions of Struts2 (2.0.x) Now we are planning to upgrade Struts2 version which has some improvements and bug fixes.

I updated the pom.xml as per that. However I found out that in my old strtus2-core lib, there's

org.apache.struts2.views.util.TextUtil

But in latest version it's not there and I am facing compilation errors.

Any idea why it's missing or how do i get it?

有帮助吗?

解决方案

Indeed org.apache.struts2.views.util.TextUtil was removed from Struts 2 after 2.1.6. You have a few options.

First, as Jaiwo99 indicated, Struts 2 is licensed under the Apache License v2, so you can just take a copy of the source for TextUtil from Struts 2.1.6 and put it in your application. The class has no dependencies on other code, so it should work fine.

Second, you could look at using StringEscapeUtils from Apache Commons Lang 3, which is now used by Struts2 for escaping HTML and JavaScript. Specifically, look at StringEscapeUtils.escapeHtml4() method.

其他提示

Could it be this one?

com.opensymphony.xwork2.util.TextParserUtil
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top