Photoshop CS6 makes it easy.
With Photoshop CS5.5 and older, the best way is to make a path in the shape you want, then stroke it with a brush that's been prepared with the proper spacing and direction dynamics to cause the stroke to be dotted or dashed.
Generally speaking you can find a lot of tutorials for doing it via Google. What I might do is to search for something along the lines of dashed stroke photoshop, possibly also adding the word tutorial in the mix, then use the Google Images search, find one that looks like what you're trying to accomplish, and click through the Website For This Image link.
Here's one of the first I ran across with such a search: http://www.techimo.com/forum/graphic-design-digital-photography/110702-mini-tutorial-photo shop-making-dotted-dashed-lines-complex-path.html
1 person found this helpful
Would be nice if Adobe borrowed code from Illustrator to make dashed lines "perfect" at the corners....too much fiddling around in Ps;
at this point still easier to make some dashed lines in Ai and import into Ps.
Maybe CS7 will have better dashed line capabilities?