Struts2 xml validation on HTML tags -
we migrating our application struts1 struts2.
our forms composed html tags , not using struts2 tags. forms displayed without problem. when add struts xml validation files forms empty (no input displayed).
is there way use struts2 xml validation on html tags ?
i suggest use validate()
method actionsupport
class. method have wide range of validation possibilities. struts validators have possibility check single values without relation, see struts form validation.
with method can check whatever want:
public class myaction extends actionsupport { string valuetocheck = ""; @override public void validate() { if (valuetocheck.isempty()) { addfielderror("valuetocheck", "please fill in..."); } } }
if fielderrors
-map filled, validation method return result of type input
, otherwise execute()
-method called (or maybe defined).
Comments
Post a Comment