package web.app.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(“/IndexController”)
public class IndexController extends HttpServlet
{
package web.app.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(“/IndexController”)
public class IndexController extends HttpServlet
{
private static final long serialVersionUID=-8227194254553105913L;
@Override
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException
{
try{
response.setCharacterEncoding(“utf-8”);
response.setContentType(“text/html;charset=utf-8”);
//response.getWriter().println(“success”);
request.setAttribute(“test”,”hello world this is class name index controller”);
request.getRequestDispatcher(“view/index.jsp”).forward(request, response);;
}catch(Exception e)
{
System.out.println(“error”);
e.printStackTrace();
}
}
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。