SPRINGMVC_ View parser and Chinese garbled problem

Source: Internet
Author: User

return "/pages/front/success.jsp";

return "/pages/front/fail.jsp";

The structure of these two sentences is: prefix (prefix) + change value + suffix (suffix)

The prefix is/pages/front/. The suffix is. jsp

In the Springmvc.xml configuration file, the prefix suffix is configured with the view parser so that return has only the change value: Return "Success";

Springmvc.xml:

Hold down CTRL shift H, search for Internalresourceviewresolver, and then right-click Copy qualified name. Paste into the class.

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"Xmlns:context= "Http://www.springframework.org/schema/context"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2 . xsd Http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mv C-4.2.xsd Http://www.springframework.org/schema/context Http://www.springframework.org/schema/cont Ext/spring-context-4.2.xsd ">        <!--Configure package Scan -            <Context:component-scanBase-package= "Cn.java.controller"></Context:component-scan>            <!--added SPRINGMVC-specific annotation drivers -        <Mvc:annotation-driven></Mvc:annotation-driven>            <!--View Resolver -    <!--prefix: prefix -    <!--suffix: suffix -    <BeanID= "Internalresourceviewresolver"class= "Org.springframework.web.servlet.view.InternalResourceViewResolver">        < Propertyname= "prefix"value= "/pages/front/"></ Property>        < Propertyname= "suffix"value= ". jsp"></ Property>    </Bean>    </Beans>

Java:

    @RequestMapping (value= "test1")    public  String test1 (String username,string password) {                 if // Login Successful            return "Success";        }         Else // Logon Failure             System.out.println (username);             return "Fail";        }            }  

The real return here is/pages/front/success.jsp.

SPRINGMVC_ View parser and Chinese garbled problem

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.