<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
        主站蜘蛛池模板: 在线观看亚洲免费视频| 亚洲网站免费观看| 国产亚洲高清在线精品不卡| 在线视频精品免费| 亚洲香蕉久久一区二区三区四区| 国产精品成人观看视频免费 | 国产无遮挡裸体免费视频在线观看| 亚洲第一网站男人都懂| 日本特黄特色AAA大片免费| 免费一区二区视频| selaoban在线视频免费精品| 亚洲精品99久久久久中文字幕 | 亚洲人成影院77777| 好大好硬好爽免费视频| 日韩亚洲人成网站| 亚洲情侣偷拍精品| 久久青草免费91线频观看站街| 亚洲福利一区二区三区| 青青青青青青久久久免费观看| 男人扒开添女人下部免费视频| 亚洲一区二区三区偷拍女厕| 永久在线观看免费视频| 亚洲免费二区三区| 免费少妇a级毛片| 十九岁在线观看免费完整版电影| 亚洲av无码一区二区三区天堂古代 | 国产小视频免费观看| 皇色在线免费视频| 亚洲男人电影天堂| 国产资源免费观看| 久久狠狠躁免费观看2020| 亚洲日日做天天做日日谢| 亚洲AⅤ无码一区二区三区在线| 99麻豆久久久国产精品免费| 亚洲国产人成在线观看| 亚洲成A人片在线观看无码3D| 最近免费中文字幕大全高清大全1| 亚洲色精品三区二区一区| 精品国产亚洲一区二区三区| 日韩精品无码区免费专区| 手机看片国产免费永久|