Well id be sensible about it and not drink loads before going on, or i would go before getting on the train. Could also use an alternative way of getting along the line if you honestly think you may need the toilet (use the Southampton train to Havant and change there for another Southern train to Portsmouth about 5 minutes later - both have toilets).
Really? I'm probably not alone in saying that my body doesn't run on a precise time schedule, even if I do go for a piss just before I get on a train it doesn't mean I'm not going to need to go again during the journey because I didn't really need to piss in the first place. Is the correct approach to make sure you are dehydrated before boarding the train? If I pay £20 for a train ticket I shouldn't then be expected to alter my dietary routine for the 2 hours before I travel.
As for CHANGING trains to take a piss, we're not living in the third world FFS.