import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyServlet extends HttpServlet {
PrintWriter out = null;
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
try {
// Get a reader to read the incoming data
BufferedReader reader = req.getReader();
// Get a writer to write the data in UTF-8
res.setContentType("text/html; charset=UTF-8");
//PrintWriter out = res.getWriter();
out = new PrintWriter(
new OutputStreamWriter(res.getOutputStream(), "UTF8"), true);
char[] buf = new char[4 * 1024]; // 4Kchar buffer
int len;
while ((len = reader.read(buf, 0, buf.length)) != -1) {
out.write(buf, 0, len);
}
out.flush();
}
catch (Exception e) {
out.println("Problem filtering page to UTF-8");
getServletContext().log(e, "Problem filtering page to UTF-8");
}
out.println("Done");
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doGet(req, res);
}
}
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
MyServletName
MyServlet
MyServletName
*.htm
javax.servlet.jsp.jstl.fmt.timeZone
US/Central
database-driver
org.gjt.mm.mysql.Driver
database-url
jdbc:mysql://localhost/forum?user=forumuser
http://java.sun.com/jstl/fmt
/WEB-INF/fmt.tld
http://java.sun.com/jstl/fmt-rt
/WEB-INF/fmt-rt.tld
http://java.sun.com/jstl/core
/WEB-INF/c.tld
http://java.sun.com/jstl/core-rt
/WEB-INF/c-rt.tld
http://java.sun.com/jstl/sql
/WEB-INF/sql.tld
http://java.sun.com/jstl/sql-rt
/WEB-INF/sql-rt.tld
http://java.sun.com/jstl/x
/WEB-INF/x.tld
http://java.sun.com/jstl/x-rt
/WEB-INF/x-rt.tld
http://java.jeffheaton.com/taglib/jstl/forum
/WEB-INF/forum.tld
/tlt
/WEB-INF/taglib.tld