나는
first=firstvalue&second=secondvalue
당신은 쿼리 문자열을 쿼리 문자열이
귀하의 경우에,
String firstValue = request.getParameter("first");
String secondValue = request.getParameter("second");
System.out.println("Query String:first="+firstValue+"second=+"secondValue);
를 인쇄하는 서블릿이 사용할 수 있습니다처럼 쿼리 문자열이 보일 것입니다 생각
first=second=12123423423423432323234
할 수 있습니다.
String first = request.getParameter("first");
String second = request.getParameter("second");
if(first.contains("second=")){
second = first.split("second=")[1];
first = first.split("second=")[0];
}
out.println("[First:"+first+"][Second:"+second+"]");
'first = & second = 12123423423423432323234'와 같이 보이면 안됩니까? – Bohemian
이것은 유효한 쿼리 문자열이 아닙니다 ... – fge
당신은'&'로 분할 한 다음'='로 분할하고 Map를 사용하여 쿼리 매개 변수 키와 쿼리 매개 변수 값을 매핑합니다. 이것은 Java의 거의 모든 웹 프레임 워크에서 기본적으로 수행됩니다. –
Srinivas