public class SampleServlet extends HttpServlet {
public void doGet( HttpServletRequest request,
HttpServletResponse response )
throws ServletException,IOException {
response.setCharacterEncoding("Windows-31J");
PrintWriter out = response.getWriter();
out.println("<html><body>");
Cookie[] c = request.getCookies();
if ( c != null ) {
for ( int i = 0;i < c.length;i++ ) {
out.println( c[i].getName() + ":" + c[i].getValue() + ":" + c[i].getPath() + "<br>");
}
}
out.println("</body></html>");
}
}
|