Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 validation using annotaions for Model Driven

 
sarada srinivas
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to validate a username and password in a model by implemented that class in Action as Model Driven.

validation usign annotations are not working???

Can any one please help me??

If I am passing the validation directly under action class everything works fine but i want the validation using ModelDriven.

Thanks in advance
sarada.
 
sarada srinivas
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have followed these steps to proceed further but still unsucessfull.

Added init param in web.xml
1) <init-param>
<param-name>actionPackage</param-name>
<param-value>com.vaanila.action</param-value>
</init-param>

2)<s:form action="welcome" validate="true">
<s:fielderror />
<s:textfield name="userName" label="User Name" />
<s:submit />
</s:form>

3) Action class


I am geting the Error but not on the form but on the server console

SEVERE: Validation error for userName:Name required


Can some please findout what I am missing to display the error on the form???
 
sarada srinivas
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still having this issue.

Can anyone help me please....

Thanks,
sarada
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic