aspose file tools*
The moose likes Struts and the fly likes Validation not showing up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation not showing up" Watch "Validation not showing up" New topic
Author

Validation not showing up

Frederick Smythe
Greenhorn

Joined: Jan 12, 2006
Posts: 2
I have a tile which contains a form upon which I want to perform some simple validation. Originally I had a problem whereby it would correctly display the validation errors, but the rest of the page would not be displayed correctly because no parameters were being passed along. To solve this I call this method within my ValidatorActionForm:

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
//Get standard validation errors
ActionErrors errors = super.validate(mapping, request);
if (errors == null) return null;
return errors;
}

This is called by the following code in my BaseAction's execute method so that if there are errors it is redirected to the correct page:

ActionErrors errors = emailForm.validate(mapping, request);
// if there are validation errors
if (errors != null && !(errors.isEmpty()))
{

// set path to URL of original page
String propertyDetailParams = emailForm.getPropertyDetailsParams();
// new ActionForward for reloading original page
RedirectingActionForward backForward = new RedirectingActionForward(mapping.findForward("invalid"));
backForward.addParam("propertyId", propertyDetailParams);
request.setAttribute(Globals.ERROR_KEY, errors);
return backForward;
}

This redirects properly back to the correct page but no validation errors are shown; it's as though the send button was never pushed. However I have the correct <html:errors/> within the jsp tile and I know the validation works correctly on other pages.


Does anyone have any thoughts or suggestions? If you need any more info I'll happily provide it.

Cheers.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

Looks like this is a Struts question. Moving this to the Struts forum on your behalf.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Frederick Smythe
Greenhorn

Joined: Jan 12, 2006
Posts: 2
My apologies, thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation not showing up