• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

ActionMessages not found under 'messages'

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am creating some action errors / action messages and attempting to save them so I can access them in the JSP from which posted to the Action. I seem to be able to detect whether the errors are there or not with


but I get an exception with

<bean:write name="message"/>
javax.servlet.jsp.JspException: ServletException in '/jsp/icicle/CandidateForm.jsp': Cannot find bean message in any scope

This is really confusing - I appear to have the same setup on another form that works fine (I did a lot of trial and error to get that to work...)

Code snippets follow...

Many thanks for any pointers.


//Makes ActionMessages from a hashmap
errors = com.xx.struts.Utils.actionMessages( cb.validate() );
if ( !errors.isEmpty() )
// Save my errors to make them availble upon repost.

//addMessages(servletRequest, errors);
//saveMessages(servletRequest.getSession(), errors);

addErrors(servletRequest, errors);
saveErrors(servletRequest, errors);

return actionMapping.getInputForward();

<html:messages id="message">
<li><bean:write name="message"/></li>
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use these tags:

message - is whether or not they are errors or not, by the way, if your ActionForward is set to redirect, you will lose all messages.
andrew low
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so it transpires that I've been adding in ActionMessages as thinking of them as Simply strings that will be displayed, rather than keys to look up values from the ApplicationResources.properties file. I assume there is some way to add ActionMessages from scratch without referring to this file, but it appears to have evaded me.


I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic