> if (request is a web service) [ > ACUnfreezer.unfreeze(mapping); > mapping.setInput(the new JSP to go to in case of validation errors);
This might fail in the case where the Controller's 'inputForward' is set to true. I have couple of questions regarding the "jsp" that you want to go to incase of a validation error. * Is the path to that jsp going to be a constant one or is it going to come from a config file * Is the path to the jsp going to be constant no matter what web-service you are going to execute (More precisely, does the path depend on the ActionMapping) If the answer is NO to the above questions then, there are two relatively easy ways. 1) Override processValidate() like so protected boolean processValidate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) throws IOException, ServletException { if(request is a webservice){ ActionMapping am = new ActionMapping(); // clone the whole bean as Niall and Joe suggested // or just "input" am.setInput(moduleConfig.getControllerConfig().getInputForward() ? "webservice_error_foward" : "/webservice_error_jsp.jsp"); } else{ am = mapping; } return super.validate(request, response, form, am); } 2) Override "processForwardConfig" and "internalModuleRelativeForward". These are the two methods used by processValidate() to forward or redirect when an input validation happens. Just create a new method which checks whether validation passed or not by looking in the request for ActionErrors protected boolean isRequestValid(HttpServletRequest request){ ActionErrors errors = (ActionErrors)request.getAttribute(Globals.ERROR_KEY); return errors == null || errors.isEmpty(); } protected void processForwardConfig(HttpServletRequest request, HttpServletResponse response, ForwardConfig forward) throws IOException, ServletException { boolean noErrors = isRequestValid(request); if((!noErrors) && (request is a webservice)){ doForward("/webservice_error_jsp.jsp", request, response); } return super.processForwardConfig(request, response, forward); } protected void internalModuleRelativeForward( String uri, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { url = isRequestValid(request) ? url : (request is a webservice) ? "/webservice_error_jsp.jsp" : url; return super.internalModuleRelativeForward(uri, request, response); } There are pros and cons for the both hacks. First one creates a new ActionMapping. If the validate() method on the ActionForm is using the ActionMapping then you might have to clone the entire bean as apposed to set setting the input. (If you consider cloning as a con). Pros- You just change one method. Probably less impact on the future releases of Struts. Second one is simple though you have to change in two places. In future releases Struts might choose to keep the ActionErrors under a different key in the request (Although unlikely). Second one doesn't have any knowledge about ActionMapping, so it's difficult to show different error pages for different webservice invocations. (Now you know why I asked those questions) Thoughts? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]