Java tutorial
/** * LogHut is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * LogHut is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LogHut. If not, see <http://www.gnu.org/licenses/>. **/ package company.gonapps.loghut.web.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import company.gonapps.loghut.dao.SettingDao; public class SettingsAddingHandlerInterceptor extends HandlerInterceptorAdapter { private SettingDao settingDao; @Autowired public void setSettingDao(SettingDao settingDao) { this.settingDao = settingDao; } @Override public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final ModelAndView modelAndView) { if (modelAndView != null) modelAndView.getModelMap().addAttribute("settings", settingDao); } }