if (action instanceof TemplateAction) {
TemplateAction templateAction = (TemplateAction) action;
String templateName = templateAction.getTemplateName();
if (templateAction.isEvaluate()) {
JexlContext jc = JexlHelper.createContext();
jc.getVars().put("handler", handler);
templateName = "" + templateAction.getExpression().evaluate(jc);
}
processTemplate(request, response, templateName, handler);
return true;
}
if (action instanceof DispatcherAction) {
request.setAttribute("handler", handler);
DispatcherAction location = (DispatcherAction) action;
request.getRequestDispatcher(location.getLocation()).forward(request, response);
return true;
}
if (action instanceof RedirectAction) {
RedirectAction redirectAction = (RedirectAction) action;
String location = redirectAction.getLocation();
if (redirectAction.isEvaluate()) {
JexlContext jc = JexlHelper.createContext();
jc.getVars().put("handler", handler);
location = "" + redirectAction.getExpression().evaluate(jc);
}
response.sendRedirect(location);
return true;