http://www.myjavaserver.com/signup提供免费的jsp空间!
cxg_c 2006-07-15 02:49:44 要回答个问题就可以申请了, -_-.
只要将下面的代码复制到框中就可以通过编程挑战了.
import java.util.*;
public class HandlerFactory
{
public String getHandler(String[] config, String requestUri)
{
HashMap hm = new HashMap();
for(int i = 0; i < config.length; i += 2)
hm.put(config[i], config[i+1]);
String con[] = new String[config.length/2];
for(int i = 0; i < con.length; i++)
con[i] = new String(config[2*i]);
for(int i = 0; i < con.length - 1; i++)
for(int j = 0; j < con.length-1-i; j++)
if(con[j].length() < con[j+1].length())
{
String temp = con[j];
con[j] = con[j+1];
con[j+1] = temp;
}
for(int j = 0; j<con.length; j++)
for(int i = 0; i < requestUri.length() - con[j].length()+1; i++)
if((requestUri.substring(i, i+con[j].length())).equals(con[j]))
return (String)hm.get(con[j]);
return "rKu8QJ"; }
}