Is it necessary to use resistor when connecting backlight of 16x2 LCD display?
This is just a complementary answer for people facing this question for the first time (beginners or even non-beginners), like I did a few months ago when received a batch of no-name LCD modules clones of the JHD162A with an incorrect datasheet. This answer only apply to LCD modules with a LED backlight (using a single LED or an array of LEDs) which are the most popular.


If you have the datasheet, it should contain the information somewhere, you just need to calculate the current limiter resistor value using the suggested LED forward current and supply voltage minus the LED forward voltage.
If you don't have the datasheet, check the back of the LCD. Usually you can find easily if there is a resistor in series with the A (or even the K) pin. The following images show how some modules which already have a limiting resistor. Just be sure it is really a resistor and not a jumper (a zero ohm "resistor").
If you find (or not) the limiting resistor, verify it is in series with the LED supply by measuring the resistance from the A pin to the anode of the backlight and from the K pin to the cathode of the backlight. The backlight usually is soldered to pads marked as A and K.
If even after inspecting and measuring you are not sure, just use a 100 or 220 ohms resistor and test.
If you are designing a PCB and you are not sure if the provisioned LCD modules will have already a resistor, just add the space for a resistor in your circuit; so later on, during production, you can use a resistor or a jumper. (Of course that kind of thing should be known in advance, but sometimes is not always possible, or the requirements may state that your circuit it should work with any LCD module).


In this image a LCD 16x2 character module has a 100 ohm resistor (R8) in series with the A pin (pin 15) trace. The value was verified measuring from pin 15 to the A pad (in the left edge) soldered to the backlight.


In this image, a JDH204A (JHD629) LCD 20x4 character module has a combination of jumpers and resistors to select what pins are for the cathode (K) and anode (A) (the table in the silkscreen describe the configuration options). In this case R9 and R11 are using jumpers, meaning pin 15 is for the anode and 16 is for the cathode of the backlight, and the R12 and R13 are the limiting resistors (they are in parallel, in this case both are 68 ohms, providing 34 ohms). The value was verified by measuring the resistance between pin 15 and the A1 pad (at the left edge) soldered to the backlight.


In this image, a JDH204A clone, there is a 51 ohm resistor in series with the A pin trace and a jumper for the K pin trace. The value was verified measuring the resistance between pin 15 and the top pad at the left edge (you can follow the trace from the resistor to that pad, so we expect it to be the LED anode connection). You may note the resistors are installed perpendicular to the position drawn in the silkscreen; the manufacturer can change easily the polarity of the A and K pins just by solder the resistor/jumper pair vertically or horizontally.


In all modules I have used over the years, the A and K pins are completely independents of the LCD and controller circuit, so you may use a different supply rail with a different voltage than the rest of the circuit. (Just note that this has just been my experience with the original JHD modules and some clones, but this may not apply to other brands).