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

validation error msg with properties file

 
Vish hari
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I am validating the fields in the formbean validate method. Following is the code for adding errors.

1) errors.add("name", new ActionError("id"));--> logonForm.java
id = UserName is invalid --> ApplicationResources.properties
Problem is ActionError cannot be resolved at all, eclipse prompts for create a class 'Action error' in the package org.struts.action.

2) errors.add("UserName",new ActionMessage("errors.required")); --> logonForm.java
errors.required = UserName is invalid --> messageresources.properties


In both the ways errors are not printing out.

In struts-config.xml, it was given that <message-resources parameter=com.org.resorces.ApplicationResources>.

Please revert back if you know the solution

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