org.springframework.web.servlet.ModelAndView.setViewName()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.springframework.web.servlet.ModelAndView.setViewName()方法的一些代码示例,展示了ModelAndView.setViewName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ModelAndView.setViewName()方法的具体详情如下:
包路径:org.springframework.web.servlet.ModelAndView
类名称:ModelAndView
方法名:setViewName

ModelAndView.setViewName介绍

[英]Set a view name for this ModelAndView, to be resolved by the DispatcherServlet via a ViewResolver. Will override any pre-existing view name or View.
[中]设置此ModelAndView的视图名称,由DispatcherServlet通过ViewResolver进行解析。将覆盖任何预先存在的视图名称或视图。

代码示例

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ Exception.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(Exception exception) {
  logger.info("自定义异常处理-Exception");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

代码示例来源:origin: roncoo/spring-boot-demo

/**
 * 统一异常处理
 * 
 * @param exception
 *            exception
 * @return
 */
@ExceptionHandler({ RuntimeException.class })
@ResponseStatus(HttpStatus.OK)
public ModelAndView processException(RuntimeException exception) {
  logger.info("自定义异常处理-RuntimeException");
  ModelAndView m = new ModelAndView();
  m.addObject("roncooException", exception.getMessage());
  m.setViewName("error/500");
  return m;
}

相关文章