Is there any way to override the init method in a servlet, so just when the servlet loads, redirects to a webpage?
public void init(HttpServletRequest request, HttpServletResponse response) {
try {
ICommand _command = (ICommand) Class.forName("Clases.FwdDisk").newInstance();
_command.initPage(request, response);
String _enlace = _command.execute(request, response);
request.getSession().setAttribute("principal", _enlace);
request.getRequestDispatcher("/index.jsp").forward(request, response);
} catch (Exception e) {
System.out.println(e);
}
}
I really need to use request and response in init...
Aucun commentaire:
Enregistrer un commentaire