package bbs;
import java.io.;
import java.util.;
import javax.servlet.;
import javax.servlet.http.;
public class ControllerServlet extends HttpServlet {
HashMap hm;
public void init() {
try {
hm = new HashMap();
hm.put("bbslist", "bbslist.jsp");
hm.put("bbsrefer", "bbsrefer.jsp");
hm.put("bbswrite", "bbswrite.jsp");
hm.put("bbswritecfm", "bbswritecfm.jsp");
hm.put("bbswriteok", "bbswriteok.jsp");
} catch (Exception e) {
System.out.println("Error:" + e.getMessage());
}
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
RequestDispatcher rd = null;
String nextaction = request.getParameter("action");
String nexturl = (String)hm.get(nextaction);
if (nexturl != null) {
rd = request.getRequestDispatcher(nexturl);
rd.forward(request, response);
}
}
}