Yes, PS3 controllers recharge when you connect them to the console.
Just plug one end of the USB cable into the PS3's USB port and the other end into the controller. Once it's connected, the controller will begin charging, so you can top it up while you play or leave it plugged in between sessions.