Those came well before. Both were summer 1997 movies.
Titanic was released along with Brosnan's 2nd Bond film in December 1997. Along with Titanic, there were another two much smaller but extremely impressive hits, As Good As It Gets (with Jack Nicholson) and Good Will Hunting (Matt Damon's and Ben Affleck's breakout movie) Those three movies were legging it out long mother*******rs.
If I am not mistaken, Lost In Space was supposed to dethrone Titanic at some stage, but it flopped badly. In the end, it was unseated by another DiCaprio movie, The Man in the Iron Mask.
But yes, overall, Titanic did not have to face great competition. Still, its global run is the most impressive in the last 3 decades at least.