3
먼저 스프링 MVC와 주석 @ModelAttribute를 사용합니다.모든 액션에 대해 모델 속성을 설정하는 방법
@Controller
public class ArticleController {
@ModelAttribute("articles")
public List<Testset> getArticles(){
return articleDao.all();
}
@RequestMapping("/first.htm")
public void first(){
}
}
Grails 컨트롤러에서 어떻게 동작합니까?
class ArticleController{
//this variable I want to in every action
List articles
def first = { }
def second = { }
def third = { }
}
은 물론 나는 모든 행동
def first = {
this.articles = Article.all()
}
이 코드를 사용할 수 있지만이 아니합니다.
도움을 주셔서 대단히 감사드립니다. 여기에 대한
class ArticleController {
def afterInterceptor = { model ->
model.articles = Article.list()
}
def first = { }
def second = { }
def third = { }
}
워드 프로세서를하고 있습니다 : 토마스