Hardy spaces with variable exponents and generalized Campanato spaces