place the units in the "attacking" army
open army management (the greek helmet)
you will see two tabs (attacking army, defending army) the attacking army should be highlighted.
below that you will see your troops in the "unit pool" click on the desired troops and use the highlighted arrows to move them into the attacking army
set up your defense the same way. (if you don't put units in the defense the AI will assign two spearmen as a default defense)
any troops on defense cannot be harmed by attacking neighbors( they come back healthy as before after the battles)