The enclosed area is optional; they don't really wander around too much anyway.
The procedure is to kill a monster or group of monsters, then use Resurrect on them, run or teleport away from the area so they turn hostile, then return and kill them again. In addition to getting experience, you can use this on boss type monsters that always drop loot, or the lizards in the Dark Forest or Verdistis sewers that have a (small) chance of dropping a charm, etc.