天空是藍(lán)色的

          做好軟件為中國(guó) #gcc -c helloworld.c -o helloworld.o //編譯目標(biāo)文件 #gcc helloworld.o -o helloworld //編譯成可執(zhí)行exe #helloworld //運(yùn)行exe
          數(shù)據(jù)加載中……
          Form組件的簡(jiǎn)單應(yīng)用Tapestry Component Reference

          Form

          描述

          管理HTML<form>的組件,其他相關(guān)組件必須被包含在組建內(nèi)部。

          當(dāng)表單被提交時(shí),Form組件會(huì)等待所有的內(nèi)部組件顯示。當(dāng)Form組件顯示時(shí)(在顯示周期,生成HTML顯示),更新屬性值和調(diào)用他們的監(jiān)聽(tīng)器。另外:每一個(gè)組件并不單單用來(lái)顯示HTML的責(zé)任(來(lái)顯示fotm),還處理它的表單提交。只有這些完畢后才Form組件才通知它的監(jiān)聽(tīng)器。

          名稱

          類型

          方向

          必須

          默認(rèn)

          描述

          listener

          IActionListener

          in

          no

           

          處理請(qǐng)求

          delegate

          IValidationDelegate

          in

          no

           

          用來(lái)處理堆棧錯(cuò)誤和報(bào)告的對(duì)象。單個(gè)實(shí)例共享給所有的ValidFieldFieldLable組件在單個(gè)form

          parameters

          Object or Object[] or List

          in

          no

           

          An array of Objects to be encoded into the URL. These parameters will be decoded when the link is triggered.

          stateful

          boolean

          in

          no

          true

          如果是ture,組件被出發(fā)時(shí)需要一個(gè)活動(dòng)的HttpSession,如果沒(méi)有會(huì)拋出StateLinkException異常。如果是false則沒(méi)有必要檢查。必要狀態(tài)的附加在URL上。

          direct

          boolean

          in

          no

          true

          默認(rèn)調(diào)用direct服務(wù),這樣減少處理請(qǐng)求的數(shù)量

          method

          String

          in

          no

          POST

          Tag<form>method參數(shù)值


          例子

           

          Home.html

           1<html>
           2    <head>
           3        <title>Tutorial: HelloWorld</title>
           4    </head>
           5<body jwcid="@Body">
           6<h1>HelloWorld Tutorial</h1>
           7
           8<form jwcid="@Form" listener="ognl:listeners.formSubmit">
           9EnterYourName
          10<br/>
          11<input jwcid="enterYourName" name="textfield" type="text"/>
          12<br/>
          13<input type="submit" value="Submit"/>
          14<br/>
          15</form>
          16
          17<span jwcid="@Insert" value="ognl:yourName"/>
          18
          19</body>
          20</html>
          21

          Home.page
           1<?xml version="1.0" encoding="UTF-8"?>
           2<!DOCTYPE page-specification
           3      PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
           4      "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
           5<!-- generated by Spindle, http://spindle.sourceforge.net -->
           6
           7<page-specification class="com.Home">
           8
           9    <description>Hello World Home Page</description>
          10    
          11
          12<property-specification name="yourName" type="java.lang.String" persistent="yes"/>
          13<component id="enterYourName" type="TextField">
          14       <static-binding name="displayName">displayName</static-binding>
          15       <binding name="value" expression="yourName"/>
          16 </component>
          17
          18</page-specification>
          19
          20

          Home.java
           1package com;
           2
           3import org.apache.tapestry.IRequestCycle;
           4import org.apache.tapestry.html.BasePage;
           5
           6public abstract class Home extends BasePage {
           7    public abstract String getYourName();
           8
           9    public static void main(String args[]) {
          10
          11    }

          12
          13    public void formSubmit(IRequestCycle cycle) {
          14        // Process the form submission.
          15    }

          16}

          17

          posted on 2005-11-08 15:06 bluesky 閱讀(912) 評(píng)論(0)  編輯  收藏 所屬分類: 框架應(yīng)用

          主站蜘蛛池模板: 崇明县| 临江市| 固原市| 五华县| 建德市| 巢湖市| 武汉市| 盐山县| 颍上县| 禹州市| 开阳县| 黄平县| 蓝山县| 崇州市| 墨竹工卡县| 建始县| 南城县| 安阳市| 万安县| 普宁市| 红原县| 晋宁县| 合阳县| 贞丰县| 静安区| 盐津县| 高州市| 金坛市| 阜新市| 崇礼县| 花莲县| 赣榆县| 吉水县| 衡阳市| 根河市| 永新县| 临沭县| 巴中市| 泸水县| 泽库县| 嘉峪关市|