• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't get error messages to display

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, In my Struts application, I have my validateForm method in my ActionForm

public ActionErrors validate(
ActionMapping mapping, HttpServletRequest request ) {
final ActionErrors errors = new ActionErrors();
...
ActionMessage am = new ActionMessage("error.accountNum.invalid");
logger.debug("Validation failure:" + am.toString());
errors.add("accountNum",am);

and then on my JSP page I have

<div>
<html:errors></html:errors>
</div>

However even though my validation form is setting values in the ActionErrors object (which I verify through my log file), those errors are displayed in the JSP. Any ideas what I'm doing wrong?

Thanks, - Dave
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you calling validation manually? If so you need to save the errors to the request.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not calling it manually. I put the ActionErrors validate method to my ActionForm and have this in my struts-config.xml file

<form-beans>
<form-bean name="REAccountLookUpBean" type="com.myco.regui.struts.accounts.AccountsForm" />
</form-beans>

<action path="/pcFlow"
type="com.myco.regui.struts.accounts.AccountsAction"
scope="request"
name="REAccountLookUpBean"
validate="true"
input="/jsp/pcAccountLookup.jsp">
</action>

The method is getting called just fine and the ActionErrors object is getting set but nothing is displayed for "<html:errors></html:errors>". Why not?

- Dave
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic