Any defendant, by appropriate plea, may put in issue the fact of indebtedness or the existence of the lien, or both, and may interpose any other defense applicable to the action; and if the court by its finding, or the jury by their verdict, as the case may be, ascertain that the plaintiff has a lien as claimed, judgment shall be entered for the amount secured thereby, interest and costs, against the party liable for the same, and establishing the lien, and condemning the property to sale for the satisfaction thereof; but if the finding or verdict is for the plaintiff only on the issue of indebtedness, a judgment shall be entered in his favor for the amount thereof as in other cases.