Minecraft: How do you place a trapdoor on the front of a despenser?

I'm trying to make what looks like a cannon on a ship i'm building and want a trapdoor connected to the front to form a flap to open up for the cannon to fire. I've seen it done in videos but i can't figure out how to place it without opening the dispenser GUI.

How do i place it?

Hold the Shift button then right-click. That should allow you to place the trapdoor without opening the dispenser interface.