You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by kenboss <ke...@dilbert.dnr.state.mn.us> on 2003/05/01 17:57:35 UTC

Using both ActionErrors and ActionMessages with the validator

List--

I am building a struts-based distributed data entry system.  When validating 
user input, I would like to use two message queues - ActionErrors for true 
errors that necessitate rejection of the entry, and ActionMessages for 
"warnings" related to incomplete entries.  If an entry is incomplete, it does 
not require rejection - rather, the system should accept the entry, but the 
record will be flagged to indicate that it will require further editing in the 
future.

If a form is submitted and generates no validation errors, it will be written to 
the database, ignoring possible incompletions (excepting that the record will be 
written with the incomplete flag set).  However, if there are validation errors, 
when the user is returned to the input page I would like to display *both* 
ActionErrors and ActionMessages.  This is where I start to run into problems.

I have coded a method in my ValidatorForm that builds an ActionMessages queue 
containing messages regarding incomplete entries.  The method returns nothing 
(void) and I figured I could just call it from within the validate() method.  
However, I find that I have no means of saving the messages.  If I could somehow 
get hold of the Action object for the current request, then I could use its 
saveMessages() method to save them.  So far I haven't been able to find a means 
of doing this, though.

Any suggestions, or alternative routes?

TIA,

--Ken Boss


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org