Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Validate errors are not being diplayed. Why?

Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im not sure what im doing wrong, but the errors (ie mandatory fields are left blank) are not being diplayed once the form is being validated.
Thank you for your time.
<action input="/HtmlFile.jsp" name="FileForm" path="/HtmlFile"
scope="session" type="ch12.HtmlFileAction" validate="true">
<forward name="default" path="/HtmlFile.jsp"/>
<body >
<html:form action="" enctype="multipart/form-data">

Item Type
<html:select name="HtmlFileForm" property="itemType">
<html ptions collection="itemlists" property="id" labelProperty="description"/>
Item ID
<html:text property="name"/>
Thumbnail Image
<html:file property="file"/>
<html:text property="price"/>
<br />
<html:submit />
public class FileForm extends ActionForm{
private String submit;

public ActionErrors validate( ActionMapping mapping, HttpServletRequest request )
ActionErrors errors = new ActionErrors();
if(getFile() ==null)
errors.add("file",new ActionError ("error.file.required"));
if ( getPrice() == null || getPrice().length() < 1 )
errors.add("price",new ActionError("error.price.required"));

return errors;
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Check that you have your message resources file (i.e. specified in your struts config.
2) Check that the file is there, where you expect it to be.
3) Check that the specified message key is present in the file.
1 I can't help with.
2 Try adding the following to your file and restarting your app, then rerunning your test that should display errors...
# html:errors tag configuration ------------------------------------------
If your file is loaded properly, your messages will now be in a bulleted list. If you see
Or something similar, your problem is likely with #3.
The only cure for that is hours of television radiation. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!