Mvc:view-controller

Source: Internet
Author: User

1. redirect

<mvc:view-controller path= "/" view-name= "Redirect:/admin/index"/>


That is, if the current path is/then redirect to/admin/index

2. View Name

<mvc:view-controller path= "/" View-name=admin/index "/>





<bean id= "Defaultviewresolver" class= "Org.springframework.web.servlet.view.InternalResourceViewResolver" P:o Rder= "2" > <property name= "viewclass" value= "Org.springframework.web.servlet.view.JstlView"/> < Property Name= "ContentType" value= "text/html"/> <property name= "prefix" value= "/web-inf/jsp/"/> & Lt;property name= "suffix" value= ". jsp"/> </bean>



The resulting view when the/web-inf/jsp/admin/index.jsp

do not want to enter controller, you can configure the static access path in Spring-mvc.xml
Xml Code
<!--access to static resource files --
   

<mvc:resources mapping= "/images/**" location= "/images/" cache-period= "31556926"/>


As such, JSP files can be accessed directly without a controller, if placed under the static path/images.

Mvc:view-controller

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.