The Tang Dynasty established jail system and management from the center authorities to local government. The legislation of the Tang Dynasty has integrated and specific in jail management, which included the male and female different prison, the shackles, the food clothes grain, the medical service, visit prisoners, the prison escape and so on, all of these materials have stipulation in details. The jail's administrative staffs also have the legal responsibility. Through Tang's literatures, sentence articles and the Dunhuang literature materials, we might understand the reality of the jail management in Tang Dynasty. Tang Dynasty has the integrity regulations on the jail management, however, it still exists the serious defects. We can often seen the flaws as following: first, the state authority has many status, prisoners should be discharged but not, which cause some sick prisoners to die; secondly, the prisoners in jail not only endure cold wind and burning hot, but also exact confession by means of torture; thirdly, the jail managers misuse the power; and the staffs are not fulfill his duty at work. Therefore, all sorts of jail' flaws thus produce. The kings order to inspect the jail managements for many times in Tang Dynasty. The contents of decrees are the same as the Ksitigarbha Bodhisattva to the Yama side to listens to the judgment. In the middle Tang Dynasty, the Ksitigarbha classics are forged, and the contents have response the jail serious flaws of Tang Dynasty.