We present spectra for 12 new ultracool dwarfs found in the DENIS infrared survey. Seven of them have spectral types at the bottom of the M-class (M8-M9.5), and the other five belong to the cooler ``L'' class. We also present spectra for the two new L dwarfs found by the EROS 2 proper-motion survey. We introduce a scheme for L dwarf classification that is based on an extension to cooler spectra of a pseudocontinuum ratio previously defined for M dwarfs. For calibrating the spectral subclasses, we use a temperature scale for late-M and L dwarfs recently obtained by Basri et al. from synthetic spectrum fitting of high-resolution profiles of Cs I and Rb I resonance lines. We define that the subclass range from L0 to L6 corresponds to the temperature range from 2200 K to 1600 K. Our subclasses L0, L1, and L2 agree with recent findings by Kirkpatrick et al., but then they diverge such that our L6 is equivalent to their L8. We find that late-M and L dwarf subclasses can be assigned either in the optical with the PC3 index or in the near-infrared with the H2O H-band index. We discuss the main photospheric features present in L dwarf spectra, in particular in the region 400-650 nm, which has never been shown before. The TiO bands at 549.7, 559.7, 615.9, and 638.4 nm fade with decreasing temperature, but do not vanish until well inside the L domain (~L5). The Na I 589.0, 589.6 nm resonance doublet in our latest object (L6) becomes the broadest atomic feature ever seen in any cool dwarf. We do not detect Hα emission in our L dwarfs later than L3. We discuss the ages and masses of our objects using their temperatures and absence or presence of lithium. Finally, we compare two L1 dwarfs with different gravities (one with lithium and one without it) and discuss differences in spectral features.