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

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

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

    Ryan's Java world!

    something about Java and opensource!

    BlogJava 首頁 新隨筆 聯系 聚合 管理
      51 Posts :: 25 Stories :: 59 Comments :: 0 Trackbacks
    Form大概是動態web中使用最多的吧,在wicket中提供了靈活的form處理和呈現. 可以實現強大的功能,同時使用起來也是很簡單的. 看幾個示例就知道如何使用了, 下面是一個基本form的示例:
    代碼下載: http://bbs.hexiao.cn/read.php?fid=9&tid=16&fpage=1
    所需庫文件下載: http://bbs.hexiao.cn/read.php?fid=9&tid=12&fpage=1
    java code:
    // Add a FeedbackPanel for displaying our messages
    ? ? ? ? ? ?FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
    ? ? ? ? ? ?add(feedbackPanel);

    ? ? ? ? ? ?// Add a form with an onSubmit implementation that sets a message
    ? ? ? ? ? ?add(new Form("form") {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("the form was submitted!");
    ? ? ? ? ? ? ? ? ?}
    ? ? ? ? ? ?});

    ? ? ? ? ? ?// 測試button form
    ? ? ? ? ? ?Form buttonForm = new Form("buttonForm") {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("點擊了buttonForm.");
    ? ? ? ? ? ? ? ? ?}
    ? ? ? ? ? ?};

    ? ? ? ? ? ?Button button1 = new Button("button1") {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("button1.onSubmit 被點擊了");
    ? ? ? ? ? ? ? ? ?}
    ? ? ? ? ? ?};
    ? ? ? ? ? ?buttonForm.add(button1);

    ? ? ? ? ? ?Button button2 = new Button("button2") {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("button2.onSubmit 被點擊了");
    ? ? ? ? ? ? ? ? ?}
    ? ? ? ? ? ?};
    ? ? ? ? ? ?button2.setDefaultFormProcessing(false);
    ? ? ? ? ? ?buttonForm.add(button2);

    ? ? ? ? ? ?add(buttonForm);
    ? ? ? ? ? ?// 測試 Submit link in form
    ? ? ? ? ? ?Form submitForm = new Form("submitForm") {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("Form onsubmit");
    ? ? ? ? ? ? ? ? ?}
    ? ? ? ? ? ?};
    ? ? ? ? ? ?add(submitForm);
    ? ? ? ? ? ?SubmitLink internal = new SubmitLink("internal") {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("internal onsubmit");
    ? ? ? ? ? ? ? ? ?};
    ? ? ? ? ? ?};
    ? ? ? ? ? ?submitForm.add(internal);

    ? ? ? ? ? ?SubmitLink external = new SubmitLink("external", submitForm) {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("external onsubmit");
    ? ? ? ? ? ? ? ? ?};
    ? ? ? ? ? ?};
    ? ? ? ? ? ?add(external);

    ? ? ? ? ? ?// 測試TextField And TextArea
    ? ? ? ? ? ?final Input input = new Input();
    ? ? ? ? ? ?Form textForm = new Form("textForm", new CompoundPropertyModel(input)) {
    ? ? ? ? ? ? ? ? ?protected void onSubmit() {
    ? ? ? ? ? ? ? ? ? ? ? ?info("input :" + input);
    ? ? ? ? ? ? ? ? ? ? ? ?if (input.bool.booleanValue()) {
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?info("Ok, ok... we'll check it");
    ? ? ? ? ? ? ? ? ? ? ? ?} else {
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?info("So you don't want it checked huh?");
    ? ? ? ? ? ? ? ? ? ? ? ?}
    ? ? ? ? ? ? ? ? ?}
    ? ? ? ? ? ?};
    ? ? ? ? ? ?add(textForm);
    ? ? ? ? ? ?textForm.add(new TextField("textField"));
    ? ? ? ? ? ?textForm.add(new TextField("integer", Integer.class));
    ? ? ? ? ? ?textForm.add(new TextArea("textArea"));
    ? ? ? ? ? ?textForm.add(new CheckBox("bool"));

    Html code:
    <?xml version="1.0" encoding="UTF-8"?>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    ? <title>Wicket Examples - component reference</title>
    ? <link rel="stylesheet" type="text/css" href="style.css"/>
    </head>
    <body>
    <wicket:link><a href="CheckAndRadio.html">[go to the CheckAndRadio]</a></wicket:link>
    <h2> Feed back info </h2>
    ? ? ? <span wicket:id="feedback">feedbackmessages will be put here</span>
    ? ? ?<h1>wicket.markup.html.form.Form</h1>

    ? ? ?<p>
    ? ? ?A Form is a component that has special interaction with nested form components.
    ? ? ?Form components are components that extend from wicket.markup.html.form.FormComponent,
    ? ? ?and which are called controls in the HTML specification. Examples of such controls
    ? ? ?are textfields, checkboxes and radio buttons.
    ? ? ?Users generally "complete" a form by modifying its controls (entering text,
    ? ? ?selecting menu items, etc.), before submitting the form usually by clicking on
    ? ? ?a submit button. On a form submit, the form normally goes through a processing cycle of
    ? ? ?validation, model updating of the nested controls, possibly persisting (with cookies)
    ? ? ?the model values of the controls and calling the form's onSubmit method.
    ? ? ?</p>
    ? ? ?<p>
    ? ? ?This example shows you the basic Form itself. It has no nested controls, but it does
    ? ? ?have an implementation of onSubmit, which sets a feedback message, and it works together
    ? ? ?with a feeback panel (a panel that lists any feedback messages that were set).
    ? ? ?</p>
    ? ? ?<p>
    ? ? ? <form wicket:id="form">
    ? ? ? <input type="submit" value="click me to submit the form and display a message" />
    ? ? ? </form>
    ? ? ?
    ? ? ? <h1> button form </h1>
    ? ? ? <form wicket:id="buttonForm">
    ? ? ? ? ? ?<input type="submit" value="non wicket submit button"/>
    ? ? ? ? ? ?<input wicket:id="button1" type="submit" value="default wicket button" />
    ? ? ? ? ? ?<input wicket:id="button2" type="submit" value="wicket button with immediate == true" />
    ? ? ? </form>
    ? ? ?
    ? ? ? <h1> Submit Link Form</h1>
    ? ? ? <form wicket:id="submitForm">
    ? ? ? <a wicket:id="internal">Internal SubmitLink</a>
    ? ? ? </form>
    ? ? ? <a wicket:id="external">External SubmitLink</a>
    ? ? ?</p>
    ? ? ?<h1>TextArea and TextField form</h1>
    ? ? ?<form wicket:id="textForm">

    ? ? ? ? ? ?<table style="border: 2px dotted #fc0; width: 300px; padding: 5px;">
    ? ? ? ? ? ? <tr>
    ? ? ? ? ? ? <td>some plain text</td>
    ? ? ? ? ? ? <td><input type="text" wicket:id="textField" /></td>
    ? ? ? ? ? ? </tr>
    ? ? ? ? ? ? <tr>
    ? ? ? ? ? ? <td>an integer value</td>
    ? ? ? ? ? ? <td><input type="text" wicket:id="integer" /></td>
    ? ? ? ? ? ? </tr>
    ? ? ? ? ? ? <tr>
    ? ? ? ? ? ? <td>text Area</td>
    ? ? ? ? ? ? <td><textarea wicket:id="textArea" rows="2" cols="15">Input comes here</textarea></td>
    ? ? ? ? ? ? </tr>
    ? ? ? ? ? ? <tr>
    ? ? ? ? ? ? <td valign="top">I want it checked!</td>
    ? ? ? ? ? ? <td>
    ? ? ? ? ? ? <input type="checkbox" wicket:id="bool" />
    ? ? ? ? ? ? </td>
    ? ? ? ? ? ? </tr>
    ? ? ? ? ? ? <tr>
    ? ? ? ? ? ? <td colspan="2" align="center">
    ? ? ? ? ? ? ? <input type="submit" value="submit" />
    ? ? ? ? ? ? </td>
    ? ? ? ? ? ? </tr>
    ? ? ? ? ? ?</table>

    ? ? ? </form>
    ? ? ?
    ? ? ?
    </body>
    </html>


    截圖:


    posted on 2006-08-09 09:34 冰雨 閱讀(2122) 評論(0)  編輯  收藏 所屬分類: Opensource

    JSF中文技術文摘
    主站蜘蛛池模板: 国产AV旡码专区亚洲AV苍井空| 在线观看免费亚洲| 亚洲精品视频在线观看你懂的| 亚洲黄色免费网址| 亚洲av日韩综合一区二区三区 | 亚洲AV第一页国产精品| 亚洲熟妇无码久久精品| 精品亚洲永久免费精品| 国产精品另类激情久久久免费| 亚洲午夜无码AV毛片久久| 免费无码国产在线观国内自拍中文字幕| 国产精品免费视频播放器| 日韩亚洲人成在线综合| 亚洲成?v人片天堂网无码| 亚洲精品熟女国产| 国产乱码免费卡1卡二卡3卡| 亚洲一级毛片在线播放| 日本xxxx色视频在线观看免费| 亚洲国产天堂久久综合网站| 免费成人福利视频| 亚洲人成依人成综合网| 最近最好最新2019中文字幕免费| 亚洲人AV永久一区二区三区久久| 日韩在线观看视频免费| 日本久久久免费高清| 黄页网站在线视频免费| 亚洲精品二区国产综合野狼| 亚洲一区二区三区免费观看| 亚洲乱码av中文一区二区| 91精品免费久久久久久久久| 一区二区亚洲精品精华液| 国产一区二区三区在线免费| 亚洲天堂2016| 99视频全部免费精品全部四虎| 久久久久久亚洲精品影院| 亚洲国产电影av在线网址| 热re99久久6国产精品免费| 亚洲乱妇熟女爽到高潮的片| 区久久AAA片69亚洲| 国产精品69白浆在线观看免费| 一级A毛片免费观看久久精品|