<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
        主站蜘蛛池模板: 美女黄色免费网站| 中文字幕乱码亚洲无线三区| 色欲色欲天天天www亚洲伊| 国产免费AV片在线播放唯爱网| 久久精品国产亚洲77777| 性xxxxx大片免费视频| 亚洲AV第一页国产精品| 无码国产精品一区二区免费16| 国产成人高清亚洲| 亚洲精品视频免费观看| 亚洲人成国产精品无码| 久久九九久精品国产免费直播| 亚洲AV永久无码区成人网站| 久久久久国产精品免费看| 亚洲黄色免费观看| 成人免费的性色视频| 亚洲欧美成人一区二区三区| 全黄性性激高免费视频| 国产黄在线播放免费观看| 亚洲爆乳精品无码一区二区三区| 99精品视频免费观看| jlzzjlzz亚洲jzjzjz| 免费永久看黄在线观看app| 精品国产污污免费网站入口在线 | 免费看大黄高清网站视频在线| 亚洲性色AV日韩在线观看| 亚洲精品国产高清不卡在线| a毛片免费播放全部完整| 91亚洲视频在线观看| 国产小视频在线观看免费| 国产又黄又爽胸又大免费视频 | 毛片免费vip会员在线看| 国产精品亚洲专区在线播放| 亚洲婷婷五月综合狠狠爱| www.免费在线观看| 免费国产a理论片| 337p日本欧洲亚洲大胆色噜噜| 在线jlzzjlzz免费播放| 国产做国产爱免费视频| 精品亚洲国产成人| 国产亚洲精aa成人网站|