spiders are a bit tricky to make xp farms with because of the simple fact that they can climb. There are ways to make xp grinders with spiders and i would highly recommend looking up some tutorials on youtube. I think that spiders can climb any solid block so any block that the player cant pass through. I would recommend using Ethos design () as i have used the same design and it has served me well.
Using Fences and Doors(preferably Iron) you can block them off and have a small space to hit them trough(between the fence and the door since they don't line up).
http://www.minecraftwiki.net/wiki/File:Cavespiderleveler.png