"Viewresolver" Springmvc JSP

Source: Internet
Author: User

  1. <Bean class="Org.springframework.web.servlet.view.InternalResourceViewResolver">
  2. <property name= "prefix" value="/web-inf/jsp/" />
  3. <property name="suffix" value= ". jsp" />
  4. </Bean>

In fact, Internalresourceviewresolver's work is very simple: in front of the view logical name plus prefix, followed by suffix;

  1. <Bean id= "myviewresolver" class=" Org.springframework.web.servlet.view.ResourceBundleViewResolver ">
  2. <property name="order" value="1"/>
  3. < name= "basename" value= "views "/>
  4. </Bean>

Because multiple Viewresolver can be configured, the above resolver also has an option order, which indicates the priority.

Through controller and direct access to JSP two kinds of

I want to put the JSP that the user can access directly under the/jsp/, and put the JSP that can be accessed by the controller under/web-inf/jsp/

Spring MVC uses a variety of viewresolver issues

<BeanID= "Velocityconfigurer"class= "Org.springframework.web.servlet.view.velocity.VelocityConfigurer">          < Propertyname= "Resourceloaderpath"value= "/web-inf/velo/"/>          < Propertyname= "Velocityproperties">                    <Props>                         <propKey= "Input.encoding">Utf-8</prop>                         <propKey= "Output.encoding">Utf-8</prop>                        </Props>                </ Property>                 </Bean>  <BeanID= "Viewresolver"class= "Org.springframework.web.servlet.view.velocity.VelocityViewResolver">            < Propertyname= "Cache"value= "false"/>            < Propertyname= "prefix"value=""/>            < Propertyname= "suffix"value= ". VM"/>            < Propertyname= "ContentType"><value>Text/html;charset=utf-8</value></ Property>            < Propertyname= "Exposespringmacrohelpers"value= "true"/>            < Propertyname= "Order"><value>0</value></ Property>      </Bean>       <BeanID= "Jspviewresolver"class= "Org.springframework.web.servlet.view.InternalResourceViewResolver">            < Propertyname= "Cache"value= "false"/>            < Propertyname= "prefix"value= "/web-inf/jsp/"/>            < Propertyname= "suffix"value= ". jsp"/>            < Propertyname= "ContentType"><value>Text/html;charset=utf-8</value></ Property>            < Propertyname= "Order"><value>1</value></ Property>      </Bean>

"Viewresolver" Springmvc JSP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.