Hi all
I have a form that uses the standard form validation based on the validation.xml file. It all works fine except for when I'm pre-populating the form on first showing. The validation is kicking in before the data is retrieved from the database. Can anybody show me how to initialise the form correctly. Here is my Action class Thanks Donie import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.log4j.Category; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.MessageResources; import org.apache.commons.beanutils.BeanUtils; import com.tecnomen.mms.sm.backend.*; public final class ContentAdaptationFormMainAction extends Action { static Category log = Category.getInstance(ContentAdaptationFormMainAction.class.getName()); public ActionForward execute(ActionMapping mapping,ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception { Locale locale = getLocale(request); MessageResources messages = getResources(request); HttpSession session = request.getSession(); ActionForward forward = mapping.findForward("success"); //default // Get the data for oSystemContentAdaptation ContentAdaptationService service = new ContentAdaptationService(); ContentAdaptationForm theForm = (ContentAdaptationForm) form; ContentAdaptationDTO caDTO; int buttonSelect = theForm.getSelected(); switch(buttonSelect) { case ContentAdaptationForm.SUBMIT_BUTTON: log.info("Submit CA form"); // Create new data object for this form caDTO = new ContentAdaptationDTO(); BeanUtils.copyProperties(caDTO, theForm ); service.setContentAdaptation(caDTO); forward = new ActionForward(mapping.findForward("submit")); break; case ContentAdaptationForm.CANCEL_BUTTON: log.info("Cancel CA form"); forward = new ActionForward(mapping.findForward("cancel")); break; case ContentAdaptationForm.RESET_BUTTON: log.info("Reset CA form"); default: // Populate the form caDTO = new ContentAdaptationDTO(); caDTO = service.getContentAdaptation(); BeanUtils.copyProperties( theForm, caDTO ); break; } return forward; } }