BEIJING — Police and security officials displayed a massive show of force here and in other Chinese cities Sunday, trying to snuff out any hint of protests modeled on the uprisings in the Middle East. In Shanghai, several hundred people trying to gather were dispersed with a water truck.

Premier Wen Jiabao, meanwhile, used a morning Internet chat to promise to purge senior officials who are corrupt and to rein in inflation and rising home prices, directly addressing some of the most common grievances of ordinary Chinese.

Since the January uprising in Tunisia spurred similar anti-government protests across the Middle East and North Africa, threatening long-entrenched authoritarian regimes, China’s Communist rulers have reacted nervously, with both defensive and aggressive tactics.

Officials have used state-run media outlets to dismiss any comparisons with China while at the same time stepping up public comments on the need to address “social conflict” and to tackle problems such as the growing income disparity between the rich and poor. They have also detained a number of activists and human rights lawyers, blocked Internet search terms considered sensitive, such as “Egypt,” “Tunisia” and even U.S. Ambassador Jon Huntsman Jr.’s Chinese name. And they have issued warnings to foreign journalists to be mindful of reporting restrictions.