Is including other JSP via the Spring MVC framework a good idea?

前端 未结 2 787
有刺的猬
有刺的猬 2021-01-07 06:59

This is a vague and grand question but hopefully I can explain it with as little concrete examples as possible.

We recently switched to Spring MVC for our applicatio

2条回答
  •  礼貌的吻别
    2021-01-07 07:50

    Well in terms of your UI, Apache Tiles and Sitemesh are things you might want to look at here.

    • http://tiles.apache.org

    • http://wiki.sitemesh.org/wiki/display/sitemesh/Home

    In terms of the controller layer, Spring has the @ControllerAdvice annotation which can be used to place model attributes in scope for all controllers. If, for example, you placed the navigation model in your @ControllerAdvice, no other controller would have to worry about setting it as a model attribute.

    http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html

    @ModelAttribute methods can also be defined in an @ControllerAdvice-annotated class and such methods apply to all controllers. The @ControllerAdvice annotation is a component annotation allowing implementation classes to be autodetected through classpath scanning.

提交回复
热议问题