servlet 问题 谁帮一下不胜感激~~
import import
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class multichoice extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=GB2312");
request.setCharacterEncoding("gb2312");
PrintWriter out = response.getWriter();
try {
String[] paramValues=request.getParameterValues("checkbox1");
String temp=new String("");
for(int i=0;i<paramValues.length;i++){
temp+=paramValues[i]+" ";
}
out.println("你喜欢的水果有:"+temp+".");
} finally {
out.close();
}
}
标注红色的那部分不明白为什么。temp是String类型的,但是他不是数组啊,怎么for循环里面把一个数组付给他了,For循环完了直接就输出了呢??