10장에나오는 용어정리.

"뷰 리졸버는 컨트롤러가 리턴하는 ModelAndView의 뷰를 참고해서 뷰타입의 뷰를 결정한다. 뷰 내부에서는 컨트롤러에서 지정해준 뷰에 해당하는 JSP뷰를 사용해서 뷰를 생성한다" 는 문장이 해석이 잘 안된다면 읽어보자.

 

———————–

뷰라는 말은 여러가지 의미로 사용되고 있기 때문에 문맥에 따라 어떤 뜻으로 사용되는지 잘 파악해야 한다. 그렇지 않으면 스프링MVC의 복잡한 뷰 기술에 대한 설명을 들을 때 헷갈릴 수 있다.

기본적으로 뷰는 MVC의 한 축인 뷰 컴포넌트를 의미하는 것이다. 이 때는 모델을 이용해서 사용자에게 보여줄 내용을 만들어 내는 역할을 통틀어 말하는 것이라고 이해하면 된다. 

스프링MVC에서는 View 인터페이스를 구현해서 뷰 기능을 담당하는 다양한 클래스를 만들어 사용한다. InternalResourceView가 대표적인 View 구현 클래스이다. 그래서 뷰(View)는 DispatcherServlet이 직접 사용하는 오브젝트를 가리키는 말이기도 하다. AbstractExcelView와 같이 구현 클래스 이름으로 부르기도 하지만 때로는 JSTL뷰, RSS뷰, 엑셀 뷰라고 간단히 줄여 부르기도 한다. 스프링 MVC관점에서의 뷰는 바로 이 View타입의 오브젝트를 의미한다.

종종 JSP를 뷰라고 부르기도 한다. 그런데 JSP뷰는 DispatcherServlet이 직접 사용하는 View타입 오브젝트가 아니므로 스프링MVC입장에서는 뷰(View)가 아니다. JSP는 뷰의 한가지인 InternalResourceView가 활용하는 템플릿 파일일 뿐이다. 그럼에도 JSP뷰라고 부르는 이유는 JSP가 스프링MVC뿐 아니라 다른 MVC프레임워크에서도 광범위하게 사용되는 뷰 기술이기 때문에, 관례적으로 JSP뷰라는 표현을 사용하는 것뿐이다. 게다가 InternalResourceView는 실제로 JSP에 모든 뷰 작업을 위임하기 때문에 JSP가 사실상 모델로부터 최종 내용을 생성하는 뷰의 역할을 담당한다고 보기 때문이기도 하다. 아무튼, 이 책에서는 스프링 개발자들 사이에 자주 사용되는 표현인 JSP 뷰 템플릿 또는 JSP템플릿, JSP뷰라는 표현을 모두 사용하고 있으니 혼동하지 않도록 주의하자.

ModelAndView 오브젝트는 모델과 뷰를 리턴할 때 사용되는 오브젝트이지만, 실제로 뷰(View) 오브젝트 대신 뷰 이름을 사용하는 경우가 더 많다. 뷰 리졸버는 ‘/WEB-INF/view/hello.jsp’와 같은 뷰 이름을 참고해서 InternalResourceView를 선정해준다. 이 뷰 이름은 다시 InternalResourceView 내부에서 JSP템플릿의 위치로도 사용된다. 그런데 뷰 이름을 ModelAndView에 넣어서 리턴하는데다 JSP를 JSP뷰라고도 해서 그런지 뷰 이름을 그냥 뷰라고 부르는 경우도 있다. 특히 뷰 리졸버에서 prefix, suffix를 사용하는 경우에는 컨트롤러가 리턴하는 뷰 이름이 단순해져서 ‘hello’ 처럼 된다. 이럴 때 간단히 “hello뷰를 리턴”했다고 말하기도 한다. 스프링은 ‘논리적인(logical) 뷰 이름’이라는 표현도 자주 사용한다.

마지막으로 JSP나 일반 View오브젝트가 만들어내는 HTML이나 PDF 같은 최종 응답 결과물을 뷰라고 부르기도 한다. 이 때는 단순히 사용자가 보는 화면 또는 내용이라는 의미이다. 어떤 내용을 ‘뷰에 출력한다’라고 할 때는 이런 의미로 사용되는 것이다.

Related posts:

  1. DispatcherServlet의 디폴트 대체(fallback) 전략
  2. [토스3] 스프링 3.0.4 <mvc:default-servlet-handler/>를 이용해서 UrlRewriteFilter없이 깔끔한 URL을 만들기
  3. Spring 3.0 (3) R-543 Portlet Mocks, MVC 등등
  4. Spring 3.0 (22) Web.Servlet 모듈의 선택 라이브러리 분석
  5. InsideSpring (3) 스프링 밖에서 WebApplicationContext에 접근하기
  6. Inside Spring (6) 애노테이션 설정 지원 스프링 웹 테스트용 DispatcherServlet 만들기
  7. Spring 3.0 (21) Web 모듈의 선택 라이브러리 분석

Facebook comments:

to “뷰와 뷰(View), 뷰 이름, JSP뷰 (템플릿)”

  1. you’re in reality a good webmaster. The web site loading speed is amazing. It kind of feels that you are doing any distinctive trick. Furthermore, The contents are masterpiece. you have done a magnificent task on this matter!

  2. excellent submit, very informative. I wonder why the other experts of this sector don’t realize this. You should proceed your writing. I’m sure, you’ve a great readers’ base already!

  3. Hello there, You have done a fantastic job. I will certainly digg it and personally suggest to my friends. I’m confident they will be benefited from this site.

  4. I like what you guys are up too. Such intelligent work and reporting! Carry on the superb works guys I¡¦ve incorporated you guys to my blogroll. I think it will improve the value of my site :)

  5. I have been exploring for a little for any high-quality articles or weblog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this site. Studying this info So i’m satisfied to express that I have a very good uncanny feeling I came upon just what I needed. I such a lot for sure will make certain to don’t fail to remember this web site and give it a glance on a continuing basis.

  6. It’s really a nice and useful piece of info. I’m glad that you shared this useful info with us. Please keep us informed like this. Thanks for sharing.

  7. Thanks for discussing your ideas listed here. The other point is that when a problem appears with a laptop motherboard, people today should not take the risk of repairing that themselves because if it is not done correctly it can lead to permanent damage to the complete laptop. It’s usually safe to approach a dealer of a laptop for any repair of motherboard. They’ve already technicians who’ve an experience in dealing with mobile computer motherboard problems and can make right diagnosis and carry out repairs.

  8. I just couldn’t depart your web site prior to suggesting that I really enjoyed the standard information a person provide for your visitors? Is gonna be back often in order to check up on new posts

  9. This website online is mostly a walk-by means of for all of the information you wished about this and didn’t know who to ask. Glimpse here, and you’ll undoubtedly uncover it.

  10. You are a very capable individual!

  11. After I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a comment is added I get 4 emails with the same comment. Is there any approach you can take away me from that service? Thanks!

  12. bookmarked!!, I love your website.

  13. I appreciate, cause I found exactly what I was looking for. You’ve ended my four day long hunt! God Bless you man. Have a great day. Bye

  14. I have learned some important things by means of your post. I might also like to state that there is a situation in which you will make application for a loan and do not need a co-signer such as a Federal Student Aid Loan. But if you are getting a borrowing arrangement through a common financier then you need to be made ready to have a co-signer ready to help you. The lenders can base any decision on a few issues but the greatest will be your credit ratings. There are some creditors that will additionally look at your work history and decide based on this but in many instances it will depend on your rating.

  15. hi!,I love your writing so so much! proportion we communicate more approximately your post on AOL? I need an expert on this space to unravel my problem. May be that’s you! Looking forward to look you.

  16. Wow, incredible weblog format! How long have you ever been running a blog for? you made blogging look easy. The whole glance of your site is excellent, let alone the content!

  17. Simply wish to say your article is as astonishing. The clarity in your post is simply excellent and i could assume you are an expert on this subject. Well with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a million and please continue the rewarding work.

  18. I used to be recommended this blog by means of my cousin. I’m now not certain whether this put up is written through him as nobody else realize such exact approximately my trouble. You are wonderful! Thanks!

  19. Great website. Plenty of helpful info here. I am sending it to several buddies ans additionally sharing in delicious. And of course, thank you to your effort!

  20. It’s super site, I was looking for something like this

  21. Great post and straight to the point. I don’t know if this is truly the best place to ask but do you guys have any thoughts on where to get some professional writers? Thank you :)

  22. One thing I’d prefer to comment on is that fat burning plan fast may be accomplished by the correct diet and exercise. Someone’s size not simply affects the look, but also the actual quality of life. Self-esteem, depressive disorder, health risks, along with physical ability are disturbed in an increase in weight. It is possible to make everything right but still gain. If this happens, a problem may be the perpetrator. While excessive food rather than enough work out are usually at fault, common health conditions and widely used prescriptions can greatly add to size. Kudos for your post here.

  23. There is visibly a bundle to identify about this. I consider you made various good points in features also.

  24. Youre so cool! I dont suppose Ive read anything like this before. So nice to search out someone with some authentic thoughts on this subject. realy thank you for starting this up. this website is something that’s wanted on the net, someone with a bit originality. helpful job for bringing one thing new to the internet!

  25. Great web site. Lots of useful information here. I am sending it to several friends ans additionally sharing in delicious. And obviously, thank you in your effort!

  26. Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and all. However think about if you added some great visuals or videos to give your posts more, “pop”! Your content is excellent but with images and videos, this site could undeniably be one of the greatest in its field. Fantastic blog!

  27. Ahmaya Johannesen, 1/60 Bronte Road, Bondi Junction NSW 2022 Australia, Phone: 02 9386 9610, Mobile: 0401 848 742, Email: ahmaya@ahmaya.com

  28. Thanks for revealing your ideas. I would also like to mention that video games have been ever before evolving. Better technology and innovations have made it simpler to create realistic and interactive games. These entertainment video games were not really sensible when the real concept was first being used. Just like other designs of technological know-how, video games as well have had to evolve by many ages. This is testimony on the fast continuing development of video games.

  29. I like what you guys are up too. Such intelligent work and reporting! Carry on the superb works guys I¡¦ve incorporated you guys to my blogroll. I think it will improve the value of my web site :)

  30. I really appreciate this post. I have been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thank you again

  31. A lot of thanks for each of your work on this site. My mom enjoys participating in internet research and it’s really easy to see why. I notice all about the dynamic tactic you create worthwhile guidelines via the blog and as well as strongly encourage contribution from people on the theme and our simple princess is always being taught a great deal. Take advantage of the remaining portion of the new year. You are carrying out a pretty cool job.

  32. Magnificent goods from you, man. I have understand your stuff previous to and you are just extremely magnificent. I actually like what you’ve acquired here, really like what you’re saying and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I can’t wait to read much more from you. This is really a wonderful website.

  33. I really wanted to write a brief message to appreciate you for the marvelous techniques you are showing at this website. My rather long internet search has at the end of the day been honored with awesome facts to write about with my friends and classmates. I would say that we readers are truly endowed to live in a really good network with very many outstanding professionals with good principles. I feel very fortunate to have seen the website and look forward to really more enjoyable minutes reading here. Thanks a lot once again for a lot of things.

  34. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three e-mails with the same comment. Is there any way you can remove me from that service? Thanks!

  35. I would like to thank you for the efforts you’ve put in writing this site. I am hoping the same high-grade website post from you in the upcoming also. In fact your creative writing abilities has encouraged me to get my own website now. Really the blogging is spreading its wings fast. Your write up is a great example of it.

  36. I am always searching online for tips that can assist me. Thx!

  37. I’ll right away seize your rss feed as I can not to find your e-mail subscription link or e-newsletter service. Do you’ve any? Please permit me realize in order that I may just subscribe. Thanks.

  38. Many thanks to you for sharing these types of wonderful threads. In addition, the right travel along with medical insurance system can often eliminate those problems that come with traveling abroad. Some sort of medical emergency can before long become too expensive and that’s likely to quickly put a financial weight on the family’s finances. Having in place the ideal travel insurance bundle prior to leaving is well worth the time and effort. Cheers

  39. I do agree with all the ideas you have presented in your post. They’re very convincing and will definitely work. Still, the posts are very short for starters. Could you please extend them a little from next time? Thanks for the post.

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2017 Toby's Epril Suffusion theme by Sayontan Sinha