<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當(dāng)前位置: 首頁 - 科技 - 知識百科 - 正文

        spring mvc整合freemarker基于注解方式

        來源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 22:41:35
        文檔

        spring mvc整合freemarker基于注解方式

        spring mvc整合freemarker基于注解方式:基于網(wǎng)絡(luò)改進(jìn)為:最正常版本 代碼如下:<xml version=1.0 encoding=UTF-8> <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema
        推薦度:
        導(dǎo)讀spring mvc整合freemarker基于注解方式:基于網(wǎng)絡(luò)改進(jìn)為:最正常版本 代碼如下:<xml version=1.0 encoding=UTF-8> <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema

        基于網(wǎng)絡(luò)改進(jìn)為:最正常版本
        代碼如下:
        <?xml version="1.0" encoding="UTF-8"?>
        <beans
            xmlns="http://www.springframework.org/schema/beans"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:p="http://www.springframework.org/schema/p"
            xmlns:context="http://www.springframework.org/schema/context"
            xsi:schemaLocation="http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-2.5.xsd">

            <!-- 針對freemarker的視圖配置 -->
            <bean id="viewResolver"
                class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
                <property name="order" value="5" />
                <property name="suffix" value=".ftl" />
                <property name="contentType" value="text/html;charset=UTF-8" />
            </bean>

             
        <bean id="freemarkerConfig"
                class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
                <property name="templateLoaderPath" value="/WEB-INF/view/" />
                <property name="freemarkerSettings">
                    <props>
                        <prop key="template_update_delay">0</prop>
                        <prop key="default_encoding">UTF-8</prop>
                        <prop key="number_format">0.##########</prop>
                        <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
                        <prop key="classic_compatible">true</prop>
                        <prop key="template_exception_handler">ignore</prop>
                    </props>
                </property>
            </bean>

        Controller建立
        代碼如下:
        import javax.servlet.http.HttpServletRequest;

        import org.springframework.stereotype.Controller;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.bind.annotation.RequestMethod;
        import org.springframework.web.servlet.ModelAndView;

        @Controller
        public class SpringMvcController {

            @RequestMapping(value="/welcome",method={RequestMethod.GET}) 
            public ModelAndView getFirstPage(HttpServletRequest request) {
                //welcom就是視圖的名稱(welcom.ftl)
                ModelAndView mv = new ModelAndView("welcom");
                mv.addObject("name", "My First Spring Mvc");
                return mv;
            }
        }

        在url上敲http://localhost:8080/welcome就會到WEB-INF/view/welcom.ftl頁面渲染數(shù)據(jù)
        welcom.ftl頁面
        代碼如下:


        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Insert title here</title>
        </head>
        <body>
        Hello ${name}
        </body>
        </html>

        頁面出來的效果:
        Hello My First Spring Mvc

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        spring mvc整合freemarker基于注解方式

        spring mvc整合freemarker基于注解方式:基于網(wǎng)絡(luò)改進(jìn)為:最正常版本 代碼如下:<xml version=1.0 encoding=UTF-8> <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema
        推薦度:
        標(biāo)簽: spring mvc 注解方式
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 色天使亚洲综合一区二区 | 免费中文字幕在线| 中文字幕亚洲综合久久| 免费91麻豆精品国产自产在线观看| 亚洲精品美女久久久久99| 黄 色一级 成 人网站免费| 亚洲综合另类小说色区| 亚洲va乱码一区二区三区| 在线a级毛片免费视频| 亚洲熟妇无码AV| 免费在线观看亚洲| aaa毛片免费观看| 亚洲成人中文字幕| A级毛片内射免费视频| 日本亚洲高清乱码中文在线观看| 亚洲人成无码久久电影网站| 亚洲精品中文字幕无乱码麻豆| 皇色在线视频免费网站| 亚洲精品美女久久7777777 | 中文字幕人成人乱码亚洲电影| 男女拍拍拍免费视频网站| 久久伊人久久亚洲综合| 国国内清清草原免费视频99 | 亚洲第一男人天堂| 亚洲高清无码在线观看| 久久久久久久99精品免费| 亚洲a级成人片在线观看| 免费一级毛片免费播放| 两个人看的www高清免费观看| 久久精品国产亚洲AV嫖农村妇女| 人禽杂交18禁网站免费| 大片免费观看92在线视频线视频 | 亚洲AV无码成人精品区天堂| 999国内精品永久免费观看 | 桃子视频在线观看高清免费视频| 亚洲情A成黄在线观看动漫软件| 亚洲熟伦熟女新五十路熟妇| 美丽的姑娘免费观看在线播放| 精品视频免费在线| 久久99亚洲网美利坚合众国| 免费看国产曰批40分钟|