hi, i'm using jakarta-tomcat-4.0.1. i made servlet code that looks like below, response.setContentType("text/vnd.wap.wml"); RequestDispatcher rd = getServletContext().getRequestDispatcher("/wml1.jsp"); rd.forward(request, response); and i requested to that servlet, browser gets content type "text/html" instead of "text/vnd.wap.wml". how did i get this unexpected result? does forward method changed response object's content type? if then, how can i set the content type correctly without specifying the content type to jsp file(/wml1.jsp).
RequestDispatcher is used to chain servlets. JSP pages use content type as text/html by default. Using response.setContentType("text/vnd.wap.wml") in the JSP page may produce the desired result. Napa
Joined: Aug 02, 2001
yes you are right. i just checked the java file interpreted from the jsp out. and there was setContentType method calling like this. response.setContentType("text/html;charset=ISO-8859-1"); so setContentType before jsp executing was overwritten. thanks napa.
subject: RequestDispatcher's forward method changes response's content type