JSTL Substitua
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
<c:set var = "string2" value = "${fn:replace(string1, 'first', 'second')}" />
Jolly Jay