Disconnecting the driver's side port on the transmission cooler and connecting a short length of hose to it which is the cooler's output port so it can drain into a 5 gallon container while you add fresh ATF+4 from the top via the dipstick tube is a time-honored way of flushing the transmission. This is done while the engine is running so the transmission pump can pump the old ATF out, which can be done with the transmission shifted into Park. Fresh ATF+4 is added to the dipstick tube at the same rate the old ATF is being dumped into the container. Once the ATF flowing into the bucket turns bright-clear red, you have all the old ATF out.
That is done after you have removed and replaced the transmission pan to replace the filter. Top off the transmission with fresh ATF before you start the flushing process.
P.S. on 2002 and older TJs, the cooler's output port is on the passenger side of the radiator.