You have to have the printer set up so the router sees it first, once it's connected to the router then OS X can see it. Follow HP's directions for connecting to a router but DO NOT install any HP software. Please carefully read Apple's Printing Overview OS X Lion
The printer that I have does not have network capabilities built in.... to have the network capabilities, HP says an additional piece of equipment must be used.... in my case, an HP JetDirect 175x Print Server... I found a used one on eBay that was inexpensive, so I purchased that, and have been trying to configure it to my computer and printer for about 5 hours now.... all I got were error pages.
I have an older iMac (2008), and I wanted the ability of the use of one printer for the new and old computers.
After I read your advice, I disconnected the HP JetDirect 175x Print Server entirely, and used just a USB cable from the printer to the computer.
The printer worked great from my new computer, but I still wanted the ability of using the printer with the older computer (Wi-Fi). I went into the Print & Scan of System Preferences, and for the heck of it, I clicked the "Printer Sharing" box.
I went to the old computer, and for the heck of it, I tried printing something.... LO & BEHOLD it worked.
I don't know how it works, because as I said before, the printer is not network-ready. When I bought the printer several years ago, there were two printers of that model on the shelf. One was a HP 2015, and the other was a HP 2015n.... (n meaning network). At the time I didn't think that I would ever need a network printer, which was more expensive, so I purchased the non-network one.
Now I am truly bewildered as to how I am able to print from both computers without the HP JetDirect 175x Print Server.
Do you, or anyone else have the answer to that????