Hi,
I meet a problem in the servlets. I don't know why the concat()method has no
effects.
No error , no results. Just Like a blank line.
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
String ipaddress = new String(request.getRemoteAddr());
if (!ipname.containsKey(ipaddress))
{
ipname.put(request.getRemoteAddr(),request.getParameter("name"));
iprequest.put(request.getRemoteAddr(),request);
ipresponse.put(request.getRemoteAddr(),response);
}
// this line has no effects?????why??
//content has been initialized in the constructor as:
//content = new String(":");
content.concat(new String("~~~~~~~\n"));
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<FORM action=\"http://155.69.22.31:8080/chat/chat\"
method=\"post\">");
out.println("<P>");
out.println("<LABEL for=\"We are talking!\">We are talking!:
</LABEL><BR>");
out.println("<TEXTAREA name=\"history\" rows=\"12\"
cols=\"50\">");
out.println(content);
out.println("</TEXTAREA><BR>");
out.println("<LABEL for=\"I am speaking!\">I am speaking!:
</LABEL><BR>");
out.println("<input type=text size=40 name=message>");
out.println("<INPUT type=\"submit\" value=\"Send\"><INPUT
type=\"reset\">");
out.println("</P>");
out.println("</FORM>");
out.println("</body>");
out.println("</html>");
}
Thanksvery much!
Yang
Yang Yuexiang.vcf