/** * @RequestMapping(value='/sample/index.json') */ public function indexJson(HttpServletRequest $req, HttpServletResponse $res) { // 파라미터 획득 $email = $this->getRequestParam('email'); // 뷰로 email 값 전달 $model = new ModelMap(); $model->addAttribute('email', $email); return new ModelAndView('JSONView', $model); }
public function __construct($param, &$ex) { if (array_key_exists('contextConfigLocation', $param)) { $this->loadContextConfig($param['contextConfigLocation']); } $this->_ex = $ex; $this->request = new HttpServletRequest(); $this->response = new HttpServletResponse(); $findIt = false; $model = new ModelMap(); $model->addAttribute('exception', $ex); if (sizeof($this->_exceptionMap) > 0) { foreach ($this->_exceptionMap as $exObj) { $exMap = $exObj->getExceptionMappings(); foreach ($exMap as $exClassName => $viewTemplate) { eval("\$tarEx = new \\" . $this->getPhpNamespaceByDotNotation($exClassName) . ';'); if ($ex instanceof $tarEx) { foreach ($this->_viewResolverMap as $order => $viewResolver) { if ($viewResolver->display($this->request, $this->response, $viewTemplate, $model)) { $findIt = true; break 3; } } } } } } if (!$findIt) { if (sizeof($this->_exceptionMap) > 0) { foreach ($this->_exceptionMap as $exObj) { $viewTemplate = $exObj->getDefaultErrorView(); foreach ($this->_viewResolverMap as $order => $viewResolver) { if ($viewResolver->display($this->request, $this->response, $viewTemplate, $model)) { $findIt = true; break 2; } } } } if (!$findIt) { $this->displayError($ex); } } }