File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes ActionErrors problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionErrors problem" Watch "ActionErrors problem" New topic
Author

ActionErrors problem

Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
I'm using the validate method on ActionForm, and the validate execute every time that I request the URL contacts.do, the problem is that the error message appear in the first time that I request the URL. The message should not appear in the first time, but just when the client push the OK button... how can I cancel the error message if is the first request?
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
Are you using ValidatorActionForm? If not all you have to do is return empty ActionMessages in the validate method:



If you are using ValidatorActionForm, override validate and inside code:

[CODE]
if( "GET".equalsIgnoreCase( request.getMethod() ) )
return null;
else
return super.validate();

Unless the ok button is a get request. In that case check for the name and value of the button.
[ September 02, 2005: Message edited by: Kerry Wilson ]

http://www.goodercode.com
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ActionErrors problem