1

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?

RaceBase
  • 18,428
  • 47
  • 141
  • 202

2 Answers2

1

Could it be this one?

com.opensymphony.xwork2.util.TextParserUtil
Jaiwo99
  • 9,687
  • 3
  • 36
  • 53
  • I am not sure. But we are using from Struts2. How do I replace the same. Because it's bit legacy application. Should be handled carefully :) – RaceBase Nov 26 '12 at 14:23
  • @NitinGurram xworks2 is part of struts2! and the class is just moved from `struts2-core` to `xworks`, it is no problem at all – Jaiwo99 Nov 26 '12 at 15:14
  • @NitinGurram please check `xwork-core-x.x.x.jar`, in the package `META-INF`, you can find the license, which is Apache License v2 – Jaiwo99 Nov 26 '12 at 15:45
  • TextParseUtil (not TextParserUtil) is not the same class. – Steven Benitez Nov 26 '12 at 19:21
1

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.

Steven Benitez
  • 10,936
  • 3
  • 39
  • 50