@波总,发现在controler中 如果调用getpara()返回是空的,发现这个函数是返回的urlPara,在初始化的时候发现urlPara是空的。我用的get方式访问的。
在下面函数,发现如果action不为空,urlPara压根就不给复制。后续使用的时候就有问题了。不知道是我使用的问题,还是这个地方是一个bug?
/** * Support four types of url * 1: http://abc.com/controllerKey ---> 00 * 2: http://abc.com/controllerKey/para ---> 01 * 3: http://abc.com/controllerKey/method ---> 10 * 4: http://abc.com/controllerKey/method/para ---> 11 * The controllerKey can also contains "/" * Example: http://abc.com/uvw/xyz/method/para */ Action getAction(String url, String[] urlPara) { Action action = mapping.get(url); if (action != null) { return action; } // -------- int i = url.lastIndexOf(SLASH); if (i != -1) { action = mapping.get(url.substring(0, i)); urlPara[0] = url.substring(i + 1); } return action; }
/** * Get all para with separator char from url */ public String getPara() { if ("".equals(urlPara)) // urlPara maybe is "" see ActionMapping.getAction(String) urlPara = null; return urlPara; }