<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    大漠駝鈴

    置身浩瀚的沙漠,方向最為重要,希望此blog能向大漠駝鈴一樣,給我方向和指引。
    Java,Php,Shell,Python,服務器運維,大數據,SEO, 網站開發、運維,云服務技術支持,IM服務供應商, FreeSwitch搭建,技術支持等. 技術討論QQ群:428622099
    隨筆 - 238, 文章 - 3, 評論 - 117, 引用 - 0
    數據加載中……

    A Hello World Application in Warp

    Getting started with Wideplay's Warp Framework

    First download warp and its dependencies from the link provided above. For convenience, dependencies are packaged along with the warp core library in a zip file named warp-with-deps.zip. Unzip and place the provided jars into your application's WEB-INF/lib folder. Create a web.xml file in WEB-INF, and add the following filter mapping to it:

    <?xml version="1.0" encoding="UTF-8"?>

    <web-app version="2.4"

    xmlns="http://java.sun.com/xml/ns/j2ee"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >

    	<context-param>

    <param-name>warp.module</param-name>

    <param-value>my.example.MyModule</param-value>
    	</context-param>



    <filter>

    <filter-name>warp</filter-name>

    <filter-class>com.wideplay.warp.WarpFilter</filter-class>

    </filter>



    <filter-mapping>

    <filter-name>warp</filter-name>

    <url-pattern>/*</url-pattern>

    </filter-mapping>

    </web-app>


    Note that the parameter warp.module must specify the class name of your Warp Module class. This is typically a class that looks like so:

    package my.example; 
    public class MyModule implements WarpModule {
     	public void configure(Warp warp) {
    		//nothing required yet

     	}

     

    Now, this tells Warp to look in package my.example for page classes (and resources) to register to the runtime. Every class in the WarpModule's package and its sub-packages are considered candidates for page object registration (but only those that have corresponding templates are typically registered). You can also perform a lot of setup work in the WarpModule as we will see later on. 

    In Warp, a page is represented by a page object, and any manipulation of that page or its state is driven from the page object. OK, let's create a simple page to say hello to the world:

    package my.example;
    public class Start {

    private String message = "hello warp!";
     	//getter... 

    public String getMessage() { return message; }   

     

    In Warp, page objects are always be accompanied by a template (in this case a standard HTML template) to tell Warp how to decorate and layout the content in the page. As a convention, templates are named the same as page classes (in our case, Start.html in the / directory):

    <?xml version="1.0" encoding="UTF-8"?>

    <html xmlns:w="http://www.wideplay.com/warp/schema/warp_core.xsd"

    xmlns="http://www.w3.org/1999/xhtml"

    xml:lang="en" lang="en">



    <head>

    <title>Warp :: Hello World</title>

    </head>



    <body w:component="frame">

    <p>
    			${message}

    </p>

    </body>

    </html>


    Note that the only unusual part about this template is the attribute on body named w:component which tells Warp to decorate the <body> tag with a Frame component. The Frame component is used on nearly every page and is a kind of "wrapper" for the page (and should always be present on the <body> tag) which creates some necessary conditions for the rendering of the page by the Warp framework.

    The other noteworthy part of the template is the ${message} expression, which is a property expression telling Warp to look into the corresponding page object for a property named message. If you look above, we've declared message as a String in our Start page class. 

    You should now have a web application with roughly the following structure:

    	/
    	 - Start.html 
    	 - WEB-INF/
    		- web.xml
    		+ lib/
    		+ classes/

    Running the web aplication and pointing your browser at http://localhost:8080/Start now will produce the following page output:



    Contribute to the Warp Framework

    Get involved! Email me on the Warp mailing list if you want to help or have a problem to report. Problems with Guice should be reported on the Guice user mailing list.

    posted on 2009-02-17 16:28 草原上的駱駝 閱讀(289) 評論(0)  編輯  收藏 所屬分類: JAVA框架

    主站蜘蛛池模板: 国产99视频精品免费视频7| 在线中文高清资源免费观看| 亚洲精品亚洲人成在线观看下载| 亚洲中文字幕无码av永久| 99久久免费精品国产72精品九九 | 久久亚洲私人国产精品vA| 香蕉成人免费看片视频app下载| 国产亚洲精品xxx| 久久国产乱子伦免费精品| 亚洲黄色免费在线观看| 中文字幕av无码无卡免费| 亚洲日韩一中文字暮| 免费在线精品视频| 99re6在线视频精品免费| 亚洲AV无码成人精品区蜜桃| 日本免费人成在线网站| 亚洲国产精品美女久久久久| 国产无遮挡裸体免费视频| 亚洲第一视频在线观看免费| 亚洲av综合av一区| 丁香花免费完整高清观看| 黄色毛片免费网站| 亚洲AV无码精品色午夜果冻不卡 | 亚洲AⅤ无码一区二区三区在线 | 噼里啪啦电影在线观看免费高清| 亚洲精华液一二三产区| 久久精品国产亚洲Aⅴ香蕉| 国产免费一区二区三区在线观看| 久久久久久亚洲AV无码专区| 成年美女黄网站色大免费视频| 羞羞漫画页面免费入口欢迎你| 亚洲另类激情综合偷自拍图| 嘿嘿嘿视频免费网站在线观看| 亚洲AV无码国产一区二区三区| 中文字幕人成人乱码亚洲电影| 美女内射毛片在线看免费人动物| 亚洲精品人成网线在线播放va| 亚洲一区二区三区自拍公司| 五月婷婷综合免费| 国产一级a毛一级a看免费人娇| 亚洲va成无码人在线观看|