do not just put everything on front-line attack, I always have some troops on front-line defense as well. The defending formations are generally comprised of cheaper but defensible units like infantry. As the combat continues defending units will fortify (assuming CON units exist) and become even tougher. Regardless they will soak up most of the casualties and shield your attackers and most importantly, support level units like artillery, high level HQs.
If you have units on front line defence, do they fight enemy units which are also on front line defence or are you relying on the enemy putting some units on front line attack?
I seem to recall some people indicating that units on front line defence don't fight against other units in front line defence, although I might be mistaken?
Front-line defense will only fight enemies that are on front-line attack, this is still important since your units on front-line attack are focused more on enemies on the defense. Generally speaking you can rely on the fact that at least some of the enemy is going to attack you. Even if they don't, if for some reason combat is favourable, your now-fortified defenders will be able to hold a beachhead while you bring reinforcements or allow you to at least withdraw some of your forces and cut your losses.
In my case I had a massive tech advantage over an NPR homeworld so I sent and invasion of around 1.7m tons against 1.7m tons. I found that most of my casualties were focused around my troops that were on front-line defence. To me this indicates that having some forces focus on defence gives your attacking forces important breathing space by drawing fire away from them.
Also don't forget that your defending troops will fortify over time, making them become more efficient in combat as the fighting drags on.
Note: My 1.7m tons excludes logistics whereas the enemies 1.7m tons includes their logistics and I had OBS support, so even with massive tech advantage to ensure a landslide victory I brought an overall numerical superiority.
Edit: Officers are also important because their training increases morale, morale increases accuracy and evasion and elements that take massive losses will lose morale.
Edit2: For artillery focus their support on units that are attacking the enemy, I read somewhere on this form that FFD increases rear echelon artillery accuracy. By the end of my invasion I had medium and heavy artillery formations with 100k tons destroyed. They were mostly supporting mechanized and motorized elements that were on the offensive.