快速业务通道

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 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号