Struts源码研究 - Action-Input属性篇 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-15
题,再来看看出错信息,如下:
java.lang.IllegalArgumentException: Path createuser does not start with a "/" characterat org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:1179)at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:174)at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345)at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) 。。。以下省略。。。 Struts源码研究 - Action-Input属性篇(3)时间:2011-08-18出错信息清楚的说明,“createuser”这个path应该以“/”字符开头 为定位这个错误,从以上错误信息,开始打开Struts的源码RequestProcessor.java进行研究,首先来到这一段: public class RequestProcessor {。。。。。。protected boolean processValidate(HttpServletRequest request,HttpServletResponse response,ActionForm form,ActionMapping mapping)throws IOException, ServletException {if (form == null) {return (true);}// Was this request cancelled?if (request.getAttribute(Globals.CANCEL_KEY) != null) {if (log.isDebugEnabled()) {log.debug(" Cancelled transaction, skipping validation");}return (true);}// Has validation been turned off for this mapping?if (!mapping.getValidate()) {return (true);}// Call the form bean''s validation methodif (log.isDebugEnabled()) {log.debug(" Validating input form properties");}ActionMessages errors = form.validate(mapping, request);if ((errors == null) || errors.isEmpty()) {if (log.isTraceEnabled()) {log.trace(" No errors detected, accepting input");}return (true);}// Special handling for multipart requestif (form.getMultipartRequestHandler() != null) {if (log.isTraceEnabled()) {log.trace(" Rolling back multipart request");}form.getMultipartRequestHandler().rollback();}// Has an input form been specified for this mapping?String input = mapping.getInput();if (input == null) {if (log.isTraceEnabled()) {log.trace(" Validation failed but no input form available");}response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,getInternal().getMessage("noInput",mapping.getPath()));return (false);}// Save our error messages and return to the input form if possibleif (log.isDebugEnabled()) {log.debug(" Validation failed, returning to ''" + input + "''");}request.setAttribute(Globals.ERROR_KEY, errors);if (moduleConfig.getControllerConfig(). |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Struts源码研究 - Action-Input属性篇 - 编程入门网的所有评论