<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>wicket praxis &#187; form</title>
	<atom:link href="http://www.wicket-praxis.de/blog/tag/form/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wicket-praxis.de/blog</link>
	<description>erfahrungen mit wicket aus dem projektalltag</description>
	<lastBuildDate>Fri, 26 Aug 2011 11:14:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Wicket &#8211; kombiniertes AutoCompleteBehavoir</title>
		<link>http://www.wicket-praxis.de/blog/2010/02/05/wicket-combined-autocomplete-behavoir/</link>
		<comments>http://www.wicket-praxis.de/blog/2010/02/05/wicket-combined-autocomplete-behavoir/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 08:09:25 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Wicket]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[behavior]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.wicket-praxis.de/blog/?p=244</guid>
		<description><![CDATA[Eine der ersten Demonstrationen für die Möglichkeiten von Ajax bestand darin, dass man dem Nutzer während er Eingabe von Informationen Vorschläge unterbreitete, was er denn wohl gemeint haben könnte. Das ist lange her und gehört zum guten Ton einer moderneren Webanwendung. Wicket liefert das notwendige Werkzeug bereits mit, so dass sehr einfach ist, den Nutzer [...]]]></description>
			<content:encoded><![CDATA[<p>Eine der ersten Demonstrationen für die Möglichkeiten von Ajax bestand darin, dass man dem Nutzer während er Eingabe von Informationen Vorschläge unterbreitete, was er denn wohl gemeint haben könnte. Das ist lange her und gehört zum guten Ton einer moderneren Webanwendung. Wicket liefert das notwendige Werkzeug bereits mit, so dass sehr einfach ist, den Nutzer auf diese Art zu unterstützen.</p>
<p>Etwas komplizierter wird es, wenn man dem Nutzer Vorschläge unterbreiten möchte, die nicht nur für ein Eingabefeld relevant sind, sondern wie z.B. bei der Postleitzahl auch den Wert eines anderen Eingabefeldes beeinflussen kann. Im folgenden Beispiel versuchen wir, dem Nutzer bei der Eingabe einer Postleitzahl auch den Ort mit anzuzeigen und den Wert in das Ortsfeld zu übernehmen.</p>
<p>Normalerweise kommen die Daten für die Postleitzahlen aus einer Datenbank, in unserem Beispiel begnügen wir uns mit einer sehr kleinen Auswahl:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.form.autocomplete</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PlzOrt <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399; font-weight: bold;">Serializable</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">String</span> _plz<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">String</span> _ort<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> PlzOrt<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> plz, <span style="color: #003399; font-weight: bold;">String</span> ort<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_plz=plz<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_ort=ort<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getPlz<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> _plz<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getOrt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> _ort<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.form.autocomplete</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PlzOrtListFactory <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399; font-weight: bold;">Serializable</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span> _all=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">ArrayList</span><span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_all.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlzOrt<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;23562&quot;</span>, <span style="color: #0000ff;">&quot;Lübeck&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_all.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlzOrt<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;23858&quot;</span>, <span style="color: #0000ff;">&quot;Reinfeld&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_all.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlzOrt<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;14199&quot;</span>, <span style="color: #0000ff;">&quot;Berlin&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_all.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlzOrt<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;70619&quot;</span>, <span style="color: #0000ff;">&quot;Stuttgart&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> PlzOrtListFactory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span> getList<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> plz<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span> ret=<span style="color: #006600; font-weight: bold;">null</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>plz<span style="color: #339933;">!</span>=<span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>plz.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">ArrayList</span><span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>PlzOrt po : _all<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>po.<span style="color: #006633;">getPlz</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">startsWith</span><span style="color: #009900;">&#40;</span>plz<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ret.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>po<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> ret<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Die Methode getList() liefert dann die passende Teilmenge für die eingegebene Postleitzahl. Wenn der Nutzer also &#8220;23&#8243; eingeben hat, werden die ersten beiden Einträge aus der Liste gewählt.</p>
<p>Wicket hat die Möglichkeit, dem Nutzer Vorschläge unterbreiten zu können, von der Darstellung dieser Vorschläge getrennt. Die relevanten Anpassungen müssen in unserem Fall in der Darstellungskomponente vorgenommen werden. Dazu leiten wir einen eigenen Renderer von einer passenden Wicket-Basisklasse ab:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.form.autocomplete</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.Response</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.extensions.ajax.markup.html.autocomplete.AbstractAutoCompleteRenderer</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.FormComponent</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PlzOrtRenderer <span style="color: #000000; font-weight: bold;">extends</span> AbstractAutoCompleteRenderer<span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;FormComponent<span style="color: #339933;">&lt;?&gt;</span> _ortInput<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> PlzOrtRenderer<span style="color: #009900;">&#40;</span>FormComponent<span style="color: #339933;">&lt;?&gt;</span> ortInput<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_ortInput=ortInput<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_ortInput.<span style="color: #006633;">setOutputMarkupId</span><span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399; font-weight: bold;">String</span> getTextValue<span style="color: #009900;">&#40;</span>PlzOrt object<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> object.<span style="color: #006633;">getPlz</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> renderChoice<span style="color: #009900;">&#40;</span>PlzOrt object, Response response, <span style="color: #003399; font-weight: bold;">String</span> criteria<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;response.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>object.<span style="color: #006633;">getPlz</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> + <span style="color: #0000ff;">&quot;-&quot;</span> + object.<span style="color: #006633;">getOrt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399; font-weight: bold;">CharSequence</span> getOnSelectJavascriptExpression<span style="color: #009900;">&#40;</span>PlzOrt plzort<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">StringBuilder</span> js = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">StringBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;js.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;wicketGet('&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>_ortInput.<span style="color: #006633;">getMarkupId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;').value ='&quot;</span> + plzort.<span style="color: #006633;">getOrt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> + <span style="color: #0000ff;">&quot;';&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;js.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> js.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>In unserer Variante werden folgende Anpassungen vorgenommen: Für das zweite Eingabefeld wird die Ausgabe der MarkupId aktiviert, da wir uns später im Javascript darauf beziehen. Die Methode getTextValue() liefert den Wert zurück, der dann im Eingabefeld für die Postleitzahl erscheint. In der Methode renderChoice() wird die Auswahl gerendert. In unserem Fall zeigen wir Postleitzahl und Ort an. Damit der Ortsname korrekt im anderen Eingabefeld erscheint, übergeben wir durch das Überschreiben der Methode getOnSelectJavascriptExpression() die nötigen Javascript-Aufrufe. Die erste Zeile ermittelt das Objekt und setzt das Atrribut &#8220;input&#8221; auf den gewünschten Wert. Dabei ist zu beachten, dass die Zeile &#8220;input&#8221; den Wert darstellt, der in das Postleitzahlfeld geschrieben werden soll. Es sollte an dieser Stelle keine return-Anweisung aufgerufen werden.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.form.autocomplete</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Collections</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Iterator</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteBehavior</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.FormComponent</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">class</span> PlzAutoCompleteBehavior <span style="color: #000000; font-weight: bold;">extends</span> AutoCompleteBehavior<span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;PlzOrtListFactory _listFactory<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> PlzAutoCompleteBehavior<span style="color: #009900;">&#40;</span>PlzOrtListFactory listFactory, FormComponent<span style="color: #339933;">&lt;?&gt;</span> ortInput<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlzOrtRenderer<span style="color: #009900;">&#40;</span>ortInput<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;_listFactory=listFactory<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399; font-weight: bold;">Iterator</span><span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span> getChoices<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> input<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span>PlzOrt<span style="color: #339933;">&gt;</span> list = _listFactory.<span style="color: #006633;">getList</span><span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>list<span style="color: #339933;">!</span>=<span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> list.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399; font-weight: bold;">Collections</span>.<span style="color: #006633;">EMPTY_LIST</span>.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Wir leiten für dieses Beispiel unsere eigenes Behavior passend ab (Natürlich ist es möglich, das Behavior und den Renderer allgemeingültiger zu gestalten. Darauf wurde aber zu Gunsten der Lesbarkeit verzichtet.) Hinweis: Der Rückgabewert von getChoices() darf in diesem Fall nicht null sein.</p>
<p>Jetzt können wir endlich das Formular bauen und das Behavior einsetzen:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.form.autocomplete</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.extensions.ajax.markup.html.autocomplete.DefaultCssAutocompleteTextField</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.CSSPackageResource</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.WebPage</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.Form</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.TextField</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.model.Model</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FormAutoCompletePage <span style="color: #000000; font-weight: bold;">extends</span> WebPage</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> FormAutoCompletePage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span>CSSPackageResource.<span style="color: #006633;">getHeaderContribution</span><span style="color: #009900;">&#40;</span>DefaultCssAutocompleteTextField.<span style="color: #000000; font-weight: bold;">class</span>,<span style="color: #0000ff;">&quot;DefaultCssAutocompleteTextField.css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;Form<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Void</span><span style="color: #339933;">&gt;</span> form = <span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Void</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;form&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">TextField</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span> plz = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">TextField</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;plz&quot;</span>,Model.<span style="color: #006633;">of</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">TextField</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span> ort = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">TextField</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ort&quot;</span>,Model.<span style="color: #006633;">of</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;plz.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlzAutoCompleteBehavior<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlzOrtListFactory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,ort<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>plz<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>ort<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span>form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Für die Darstellung der Auswahl müssten wir jetzt noch etwas CSS bemühen. Das ersparen wir uns in diesem Beispiel, in dem wir die CSS-Datei der DefaultCssAutocompleteTextField-Klasse einbinden.</p>
<p>Eine kleine Besonderheit ist zu beachten: Man muss die Vorschläge, die der Browser dem Nutzer macht, unterbinden, damit die beiden Auswahlmöglichkeiten nicht kollidieren. Dazu fügt man im Markup das Attribut &#8220;autocomplete&#8221; mit dem Wert &#8220;off&#8221; hinzu.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>FormAutoCompletePage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Postleitzahl: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;plz&quot;</span> autocomplete<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;off&quot;</span> &gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">input</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ort: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ort&quot;</span> autocomplete<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;off&quot;</span> &gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">input</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Button&quot;</span>&gt;</span> </li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Und so sieht es dann aus:</p>
<p><img src="http://www.wicket-praxis.de/blog/wp-content/uploads/2010/02/wicket-combined-autocomplete-behavoir.jpg" alt="wicket-combined-autocomplete-behavoir" title="wicket-combined-autocomplete-behavoir" width="251" height="90" class="aligncenter size-full wp-image-245" /></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2010%2F02%2F05%2Fwicket-combined-autocomplete-behavoir%2F&amp;title=Wicket%20-%20kombiniertes%20AutoCompleteBehavoir%20&amp;bodytext=Eine%20der%20ersten%20Demonstrationen%20f%C3%BCr%20die%20M%C3%B6glichkeiten%20von%20Ajax%20bestand%20darin%2C%20dass%20man%20dem%20Nutzer%20w%C3%A4hrend%20er%20Eingabe%20von%20Informationen%20Vorschl%C3%A4ge%20unterbreitete%2C%20was%20er%20denn%20wohl%20gemeint%20haben%20k%C3%B6nnte.%20Das%20ist%20lange%20her%20und%20geh%C3%B6rt%20zum%20guten%20Ton%20e" title="Digg"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2010%2F02%2F05%2Fwicket-combined-autocomplete-behavoir%2F" title="Sphinn"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2010%2F02%2F05%2Fwicket-combined-autocomplete-behavoir%2F&amp;title=Wicket%20-%20kombiniertes%20AutoCompleteBehavoir%20&amp;notes=Eine%20der%20ersten%20Demonstrationen%20f%C3%BCr%20die%20M%C3%B6glichkeiten%20von%20Ajax%20bestand%20darin%2C%20dass%20man%20dem%20Nutzer%20w%C3%A4hrend%20er%20Eingabe%20von%20Informationen%20Vorschl%C3%A4ge%20unterbreitete%2C%20was%20er%20denn%20wohl%20gemeint%20haben%20k%C3%B6nnte.%20Das%20ist%20lange%20her%20und%20geh%C3%B6rt%20zum%20guten%20Ton%20e" title="del.icio.us"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2010%2F02%2F05%2Fwicket-combined-autocomplete-behavoir%2F&amp;t=Wicket%20-%20kombiniertes%20AutoCompleteBehavoir%20" title="Facebook"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2010%2F02%2F05%2Fwicket-combined-autocomplete-behavoir%2F&amp;title=Wicket%20-%20kombiniertes%20AutoCompleteBehavoir%20" title="Mixx"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2010%2F02%2F05%2Fwicket-combined-autocomplete-behavoir%2F&amp;title=Wicket%20-%20kombiniertes%20AutoCompleteBehavoir%20&amp;annotation=Eine%20der%20ersten%20Demonstrationen%20f%C3%BCr%20die%20M%C3%B6glichkeiten%20von%20Ajax%20bestand%20darin%2C%20dass%20man%20dem%20Nutzer%20w%C3%A4hrend%20er%20Eingabe%20von%20Informationen%20Vorschl%C3%A4ge%20unterbreitete%2C%20was%20er%20denn%20wohl%20gemeint%20haben%20k%C3%B6nnte.%20Das%20ist%20lange%20her%20und%20geh%C3%B6rt%20zum%20guten%20Ton%20e" title="Google Bookmarks"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
<div id="vgwpixel"></div><h3  class="related_post_title">Andere Beiträge</h3><ul class="related_post"><li>11. Dezember 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/12/11/wicket-form-submit-mit-und-ohne-ajax/" title="Wicket Form Submit &#8211; mit und ohne Ajax">Wicket Form Submit &#8211; mit und ohne Ajax</a></li><li>9. September 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/09/09/migration-zu-wicket-formulare/" title="Migration zu Wicket : Formulare">Migration zu Wicket : Formulare</a></li><li>2. September 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/09/02/form-checkgroup-database/" title="Datenbankeinträge auswählen mit der CheckGroup">Datenbankeinträge auswählen mit der CheckGroup</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wicket-praxis.de/blog/2010/02/05/wicket-combined-autocomplete-behavoir/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wicket Form Submit &#8211; mit und ohne Ajax</title>
		<link>http://www.wicket-praxis.de/blog/2009/12/11/wicket-form-submit-mit-und-ohne-ajax/</link>
		<comments>http://www.wicket-praxis.de/blog/2009/12/11/wicket-form-submit-mit-und-ohne-ajax/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 08:52:29 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Technologie]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[fallback]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[submit]]></category>

		<guid isPermaLink="false">http://www.wicket-praxis.de/blog/?p=213</guid>
		<description><![CDATA[Webanwendungen ohne Formulare gibt es nicht. Dabei ist die korrekte Formularbehandlung alles andere als trivial. Zum Glück bietet Wicket eine ausgezeichnete Unterstützung für Formulare, die kaum Wünsche offen lässt. Doch auch mit Wicket sind ein paar Dinge zu beachten, um die verschiedenen Interaktionsmöglichkeiten des Nutzers korrekt zu verarbeiten. Wicket bietet die Möglichkeit, neben dem normalen [...]]]></description>
			<content:encoded><![CDATA[<p>Webanwendungen ohne Formulare gibt es nicht. Dabei ist die korrekte Formularbehandlung alles andere als trivial. Zum Glück bietet Wicket eine ausgezeichnete Unterstützung für Formulare, die kaum Wünsche offen lässt. Doch auch mit Wicket sind ein paar Dinge zu beachten, um die verschiedenen Interaktionsmöglichkeiten des Nutzers korrekt zu verarbeiten.</p>
<p>Wicket bietet die Möglichkeit, neben dem normalen Abschicken eines Formulars auch auf die angeklickten Submit-Buttons reagieren zu können. Damit man aber auch zuverlässig unterscheiden kann, ob der Nutzer das Formular durch ein Enter im Textfeld oder durch einen Klick auf einen Button abgeschickt hat, muss man ein paar Vorbereitungen treffen.</p>
<p>Für das Formular legen wir eine Bean an, welche die Daten aufnimmt.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.form.submit</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FormBean <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399; font-weight: bold;">Serializable</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">String</span> _name<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> _name<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> name<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_name = name<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Für unser Beispiel benötigen wir ein Formular, einen AjaxFallbackButton, einen normalen Button und einen Button, den wir dazu benutzen, denn Fall herauszubekommen, wenn der Nutzer einfach nur Enter gedrückt hat. Das FeedbackPanel sollte man auch nicht vergessen.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.form.submit</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.ajax.AjaxRequestTarget</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.WebPage</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.Button</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.Form</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.TextField</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.panel.FeedbackPanel</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.model.CompoundPropertyModel</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FormSubmitPage <span style="color: #000000; font-weight: bold;">extends</span> WebPage</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #006600; font-weight: bold;">int</span> _counter<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> FormSubmitPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">final</span> FeedbackPanel feedbackPanel = <span style="color: #000000; font-weight: bold;">new</span> FeedbackPanel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;feedback&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;feedbackPanel.<span style="color: #006633;">setOutputMarkupId</span><span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span>feedbackPanel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;CompoundPropertyModel<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span> formModel = <span style="color: #000000; font-weight: bold;">new</span> CompoundPropertyModel<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FormBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;Form<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span> form = <span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;form&quot;</span>,formModel<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;info<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Form Submit: &quot;</span>+_counter++<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">TextField</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Button</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;defaultSubmit&quot;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;info<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Default Button: &quot;</span>+_counter++<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Button</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;submit&quot;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;info<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Button: &quot;</span>+_counter++<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AjaxFallbackButton<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ajaxSubmit&quot;</span>,form<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span>AjaxRequestTarget target, Form<span style="color: #339933;">&lt;?&gt;</span> form<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>target<span style="color: #339933;">!</span>=<span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;info<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;AjaxSubmit Button(ajax): &quot;</span>+_counter++<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target.<span style="color: #006633;">addComponent</span><span style="color: #009900;">&#40;</span>feedbackPanel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_counter=<span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">else</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;info<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;AjaxFallbackButton: &quot;</span>+_counter++<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span>form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> onBeforeRender<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_counter=<span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onBeforeRender</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Damit man die Reihenfolge besser erkennen kann, mit der die onSubmit-Methoden aufgerufen werden, wird ein Zähler (_counter) hochgezählt und vor dem Darstellen des Formulars wieder zurückgesetzt. In diesem Beispiel liegt die entscheidende Information im Markup. Dabei ist die Reihenfolge der verschiedenen Submit-Komponenten wichtig.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>FormSubmitPage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;feedback&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;defaultSubmit&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;border:0px; width: 0px; height: 0px; visibility: collapse; display: compact;&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ajaxSubmit&quot;</span>&nbsp;&nbsp;<span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;AjaxButton&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Button&quot;</span>&gt;</span> </li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Der Button mit der Wicket-ID defaultSubmit muss vor allen anderen Submit-Komponenten stehen. Dadurch wird beim Abschicken des Formulars durch Enter dieser Button ausgewählt. Wenn einer der anderen Buttons angeklickt wird, dann wird das Formular über diesen Button abgeschickt. Doch warum soviel Aufwand? Die onSubmit()-Methode des Formulars wird doch in jedem Fall aufgerufen.</p>
<p>Der Aufwand ist notwendig, wenn man abhängig davon, ob der Nutzer auf einen Button oder eben auf keinen Button geklickt hat, eine Aktion ausführen möchte. Das bedeutet, dass man die Aktion nicht in onSubmit ausführen kann. Es ist allerdings auch nicht möglich, im onSubmit() der Buttonkomponenten ein Flag zu setzen, dass dann in der onSubmit()-Methode des Formulars aufgerufen wird, da die Methode beim AjaxFallbackButton erst nach dem onSubmit() der Komponente aufgerufen wird.</p>
<p>Folgende Ergebnisse erhält man, wenn man das Formular a) per Enter, b) per AjaxButton und c) per Button abschickt:</p>
<div id="attachment_215" class="wp-caption aligncenter" style="width: 273px"><a href="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-enter.png"><img src="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-enter.png" alt="Submit per Enter" title="wicket-form-submit-enter" width="263" height="114" class="size-full wp-image-215" /></a>
<p class="wp-caption-text">Submit per Enter</p>
</div>
<div id="attachment_216" class="wp-caption aligncenter" style="width: 281px"><a href="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-ajaxbutton.png"><img src="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-ajaxbutton.png" alt="Submit per AjaxButton" title="wicket-form-submit-ajaxbutton" width="271" height="118" class="size-full wp-image-216" /></a>
<p class="wp-caption-text">Submit per AjaxButton</p>
</div>
<div id="attachment_217" class="wp-caption aligncenter" style="width: 273px"><a href="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-button.png"><img src="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-button.png" alt="Submit per Button" title="wicket-form-submit-button" width="263" height="115" class="size-full wp-image-217" /></a>
<p class="wp-caption-text">Submit per Button</p>
</div>
<p>Wenn Javascript deaktiviert ist, dann erhält man folgende Ausgabe:</p>
<div id="attachment_215" class="wp-caption aligncenter" style="width: 273px"><a href="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-enter.png"><img src="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-enter.png" alt="Submit per Enter" title="wicket-form-submit-enter" width="263" height="114" class="size-full wp-image-215" /></a>
<p class="wp-caption-text">Submit per Enter</p>
</div>
<div id="attachment_218" class="wp-caption aligncenter" style="width: 272px"><a href="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-ajaxbutton-no-javascript.png"><img src="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-ajaxbutton-no-javascript.png" alt="Submit per AjaxButton" title="wicket-form-submit-ajaxbutton-no-javascript" width="262" height="117" class="size-full wp-image-218" /></a>
<p class="wp-caption-text">Submit per AjaxButton</p>
</div>
<div id="attachment_217" class="wp-caption aligncenter" style="width: 273px"><a href="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-button.png"><img src="http://www.wicket-praxis.de/blog/wp-content/uploads/2009/12/wicket-form-submit-button.png" alt="Submit per Button" title="wicket-form-submit-button" width="263" height="115" class="size-full wp-image-217" /></a>
<p class="wp-caption-text">Submit per Button</p>
</div>
<p>Wenn man dieses Vorgehen beherzigt, funktioniert die Anwendung auch mit deaktiviertem JavaScript genauso zuverlässig. Das freut den Nutzer und in diesem Fall auch den Entwickler:)</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F12%2F11%2Fwicket-form-submit-mit-und-ohne-ajax%2F&amp;title=Wicket%20Form%20Submit%20-%20mit%20und%20ohne%20Ajax&amp;bodytext=Webanwendungen%20ohne%20Formulare%20gibt%20es%20nicht.%20Dabei%20ist%20die%20korrekte%20Formularbehandlung%20alles%20andere%20als%20trivial.%20Zum%20Gl%C3%BCck%20bietet%20Wicket%20eine%20ausgezeichnete%20Unterst%C3%BCtzung%20f%C3%BCr%20Formulare%2C%20die%20kaum%20W%C3%BCnsche%20offen%20l%C3%A4sst.%20Doch%20auch%20mit%20Wicket%20sind%20ein" title="Digg"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F12%2F11%2Fwicket-form-submit-mit-und-ohne-ajax%2F" title="Sphinn"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F12%2F11%2Fwicket-form-submit-mit-und-ohne-ajax%2F&amp;title=Wicket%20Form%20Submit%20-%20mit%20und%20ohne%20Ajax&amp;notes=Webanwendungen%20ohne%20Formulare%20gibt%20es%20nicht.%20Dabei%20ist%20die%20korrekte%20Formularbehandlung%20alles%20andere%20als%20trivial.%20Zum%20Gl%C3%BCck%20bietet%20Wicket%20eine%20ausgezeichnete%20Unterst%C3%BCtzung%20f%C3%BCr%20Formulare%2C%20die%20kaum%20W%C3%BCnsche%20offen%20l%C3%A4sst.%20Doch%20auch%20mit%20Wicket%20sind%20ein" title="del.icio.us"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F12%2F11%2Fwicket-form-submit-mit-und-ohne-ajax%2F&amp;t=Wicket%20Form%20Submit%20-%20mit%20und%20ohne%20Ajax" title="Facebook"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F12%2F11%2Fwicket-form-submit-mit-und-ohne-ajax%2F&amp;title=Wicket%20Form%20Submit%20-%20mit%20und%20ohne%20Ajax" title="Mixx"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F12%2F11%2Fwicket-form-submit-mit-und-ohne-ajax%2F&amp;title=Wicket%20Form%20Submit%20-%20mit%20und%20ohne%20Ajax&amp;annotation=Webanwendungen%20ohne%20Formulare%20gibt%20es%20nicht.%20Dabei%20ist%20die%20korrekte%20Formularbehandlung%20alles%20andere%20als%20trivial.%20Zum%20Gl%C3%BCck%20bietet%20Wicket%20eine%20ausgezeichnete%20Unterst%C3%BCtzung%20f%C3%BCr%20Formulare%2C%20die%20kaum%20W%C3%BCnsche%20offen%20l%C3%A4sst.%20Doch%20auch%20mit%20Wicket%20sind%20ein" title="Google Bookmarks"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
<div id="vgwpixel"><img src="http://vg05.met.vgwort.de/na/182d54349d0b4270ad76cfc3ce7e8d24" width="1" height="1" alt=""></div><h3  class="related_post_title">Andere Beiträge</h3><ul class="related_post"><li>9. September 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/09/09/migration-zu-wicket-formulare/" title="Migration zu Wicket : Formulare">Migration zu Wicket : Formulare</a></li><li>9. April 2010 -- <a href="http://www.wicket-praxis.de/blog/2010/04/09/wicket-abstractevent-update/" title="Wicket &#8211; AbstractEvent Update">Wicket &#8211; AbstractEvent Update</a></li><li>7. März 2010 -- <a href="http://www.wicket-praxis.de/blog/2010/03/07/wicket-heatmap-ajax-mit-parametern/" title="Wicket Heatmap &#8211; Ajax mit Parametern">Wicket Heatmap &#8211; Ajax mit Parametern</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wicket-praxis.de/blog/2009/12/11/wicket-form-submit-mit-und-ohne-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migration zu Wicket : Formulare</title>
		<link>http://www.wicket-praxis.de/blog/2009/09/09/migration-zu-wicket-formulare/</link>
		<comments>http://www.wicket-praxis.de/blog/2009/09/09/migration-zu-wicket-formulare/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 06:08:08 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Migration]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[submit]]></category>

		<guid isPermaLink="false">http://www.wicket-praxis.de/blog/?p=120</guid>
		<description><![CDATA[Formulare sind wesentlicher Bestandteil einer Webanwendung. Doch gerade beim Umstieg von einem anderen Framework kommt es in diesem Bereich zu Irritationen. Warum? Ein wesentlicher Unterschied besteht darin, dass es in Wicket nicht zwingend eine Ergebnisseite geben muss. Ich möchte das an einem Beispiel veranschaulichen. Als erstes erstellen wir eine JavaBean in der das Formular die [...]]]></description>
			<content:encoded><![CDATA[<p>Formulare sind wesentlicher Bestandteil einer Webanwendung. Doch gerade beim Umstieg von einem anderen Framework kommt es in diesem Bereich zu Irritationen. Warum? Ein wesentlicher Unterschied besteht darin, dass es in Wicket nicht zwingend eine Ergebnisseite geben muss. Ich möchte das an einem Beispiel veranschaulichen.</p>
<p>Als erstes erstellen wir eine JavaBean in der das Formular die Daten ablegt:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.migration.forms</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FormBean <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399; font-weight: bold;">Serializable</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">String</span> _name<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> _name<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> name<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;_name = name<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Nichts besonderes. Die Bean hat das Attribut &#8220;Name&#8221;. Erstellen wir eine Seite, die über ein Formular diese Bean mit Werten füllt:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.migration.forms</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.WebPage</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.Form</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.TextField</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.model.CompoundPropertyModel</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MinimalFormPage <span style="color: #000000; font-weight: bold;">extends</span> WebPage</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> MinimalFormPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;Form<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span> form = <span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;form&quot;</span>,<span style="color: #000000; font-weight: bold;">new</span> CompoundPropertyModel<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FormBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">TextField</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span>form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Wie wir sehen, wird ein Formular eingebunden und in dieses Formular ein Textfeld für das Attribut benutzt. Damit ist dieses Beispiel funktionsfähig. Es macht nur nicht besonders viel. Was aber gut zu erkennen ist:</p>
<ul>
<li>es wird keine Ergebnisseite benötigt</li>
<li>es muss keine Methode überschrieben werden, um die Eingabedaten in der Bean abzulegen</li>
</ul>
<p>Das Markup ist ebenfalls recht einfach:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>MinimalFormPage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Name&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Absenden&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Interessant: der Submit-Button hat in diesem Beispiel keine Entsprechung als Wicket-Komponente. Das Formular wird trotzdem abgeschickt.</p>
<p><strong>Komplexes Beispiel</strong></p>
<p>Kommen wir nun zu einem etwas komplexeren Beispiel, dass eine Ergebnisseite verwendet. <strong>Dabei an dieser Stelle nocheinmal der Hinweis: die Ergebnisseite wird verwendet, weil wir das in diesem Beispiel so wollten. </strong>Alles was auf der Ergebnisseite dargestellt werden kann, könnte man auch ganz einfach auf der Seite darstellen, auf der auch das Formular eingebunden ist.</p>
<p>Als erstes erstellen wir die Ergebnisseite:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.migration.forms</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.PageParameters</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.WebPage</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.basic.Label</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ResultPage <span style="color: #000000; font-weight: bold;">extends</span> WebPage</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> ResultPage<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> name<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;init<span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> ResultPage<span style="color: #009900;">&#40;</span>PageParameters pageParameters<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;init<span style="color: #009900;">&#40;</span>pageParameters.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> name<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Label</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span>,name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>ResultPage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;Name <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Die Seite besitzt zwei Konstruktoren. Der erste erwartet einen String als Parameter, der zweite wertet die Seitenparameter aus (wenn die Seite z.B. mit ?Name=klaus aufgerufen wird). Der Wert wird durch das Label zur Anzeige gebracht.</p>
<p>Jetzt die Formularseite:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.migration.forms</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.HashMap</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Map</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.PageParameters</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.WebPage</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.Form</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.TextField</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.panel.FeedbackPanel</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.model.CompoundPropertyModel</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> KomplexFormPage <span style="color: #000000; font-weight: bold;">extends</span> WebPage</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> KomplexFormPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FeedbackPanel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;feedback&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;Form<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span> form = <span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;form&quot;</span>,<span style="color: #000000; font-weight: bold;">new</span> CompoundPropertyModel<span style="color: #339933;">&lt;</span>FormBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FormBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">// Variante 1</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setResponsePage<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ResultPage<span style="color: #009900;">&#40;</span>getModelObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">// Variante 2</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">Map</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span>,<span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span> map=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">HashMap</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span>, <span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Name&quot;</span>, getModelObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setResponsePage<span style="color: #009900;">&#40;</span>ResultPage.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #000000; font-weight: bold;">new</span> PageParameters<span style="color: #009900;">&#40;</span>map<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">// Variante ?</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">TextField</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Name&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setRequired</span><span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span>form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Wir haben in diesem Beispiel ein FeedbackPanel hinzugefügt, da wir auch das Textfeld zum Pflichtfeld gemacht haben. Ohne FeedbackPanel kommt sonst der Hinweis, dass man etwas eingeben muss, nicht zur Anzeige. Ansonsten haben wir die onSubmit-Methode überschrieben, die die Ergebnisseite aufruft. Dabei können wir zum einen eine Instanz der Seite erstellen, in dem wir (vorrausgesetzt es gibt einen passenden Konstruktor) den/die gewünschten Parameter direkt übergeben. Das wir in diesem Beispiel nur ein String übergeben, soll nicht darüber hinwegtäuschen, dass jedes beliebige (also auch weit komplexere) Objekte übergeben werden können.</p>
<p>Die zweite Variante verpackt den Parameter in einen Seitenparameter und springt die Seite dann über eine passende Url an. In diesem Fall werden natürlich die übergebenen Parameter für den Nutzer sichtbar. Das entspricht auch eher dem klassischen Verständnis einer Formularbehandlung in anderen Frameworks. Der Unterschied besteht allerdings schon darin, dass an dieser Stelle die Formularbehandlung bereits abgeschlossen ist und wir nur noch einmal absichtlich auf eine andere Seite springen.</p>
<p>Daher ist die letzte Variante auch nur mit einem Fragezeichen versehen. Wenn nichts dafür spricht, dass man eine wie auch immer geartete Ergebnisseite benötigt, kann man diese auch weglassen. Man sollte vielmehr darauf zurückgreifen, dass man Komponenten ein und ausblendet, wenn man das Formular nach erfolgreichem Ausfüllen nicht mehr anzeigen möchte.</p>
<p><strong>Zusammenfassung</strong></p>
<p>Ich hoffe, ich konnte zeigen, dass man sich vom dem klassischen Konzept einer Formularseite trennen muss und die Formularverarbeitung in Wicket ihre Entsprechung vermutlich eher in Swing findet.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F09%2Fmigration-zu-wicket-formulare%2F&amp;title=Migration%20zu%20Wicket%20%3A%20Formulare&amp;bodytext=Formulare%20sind%20wesentlicher%20Bestandteil%20einer%20Webanwendung.%20Doch%20gerade%20beim%20Umstieg%20von%20einem%20anderen%20Framework%20kommt%20es%20in%20diesem%20Bereich%20zu%20Irritationen.%20Warum%3F%20Ein%20wesentlicher%20Unterschied%20besteht%20darin%2C%20dass%20es%20in%20Wicket%20nicht%20zwingend%20eine%20Erge" title="Digg"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F09%2Fmigration-zu-wicket-formulare%2F" title="Sphinn"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F09%2Fmigration-zu-wicket-formulare%2F&amp;title=Migration%20zu%20Wicket%20%3A%20Formulare&amp;notes=Formulare%20sind%20wesentlicher%20Bestandteil%20einer%20Webanwendung.%20Doch%20gerade%20beim%20Umstieg%20von%20einem%20anderen%20Framework%20kommt%20es%20in%20diesem%20Bereich%20zu%20Irritationen.%20Warum%3F%20Ein%20wesentlicher%20Unterschied%20besteht%20darin%2C%20dass%20es%20in%20Wicket%20nicht%20zwingend%20eine%20Erge" title="del.icio.us"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F09%2Fmigration-zu-wicket-formulare%2F&amp;t=Migration%20zu%20Wicket%20%3A%20Formulare" title="Facebook"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F09%2Fmigration-zu-wicket-formulare%2F&amp;title=Migration%20zu%20Wicket%20%3A%20Formulare" title="Mixx"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F09%2Fmigration-zu-wicket-formulare%2F&amp;title=Migration%20zu%20Wicket%20%3A%20Formulare&amp;annotation=Formulare%20sind%20wesentlicher%20Bestandteil%20einer%20Webanwendung.%20Doch%20gerade%20beim%20Umstieg%20von%20einem%20anderen%20Framework%20kommt%20es%20in%20diesem%20Bereich%20zu%20Irritationen.%20Warum%3F%20Ein%20wesentlicher%20Unterschied%20besteht%20darin%2C%20dass%20es%20in%20Wicket%20nicht%20zwingend%20eine%20Erge" title="Google Bookmarks"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
<div id="vgwpixel"></div><h3  class="related_post_title">Andere Beiträge</h3><ul class="related_post"><li>11. Dezember 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/12/11/wicket-form-submit-mit-und-ohne-ajax/" title="Wicket Form Submit &#8211; mit und ohne Ajax">Wicket Form Submit &#8211; mit und ohne Ajax</a></li><li>5. Februar 2010 -- <a href="http://www.wicket-praxis.de/blog/2010/02/05/wicket-combined-autocomplete-behavoir/" title="Wicket &#8211; kombiniertes AutoCompleteBehavoir ">Wicket &#8211; kombiniertes AutoCompleteBehavoir </a></li><li>2. September 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/09/02/form-checkgroup-database/" title="Datenbankeinträge auswählen mit der CheckGroup">Datenbankeinträge auswählen mit der CheckGroup</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wicket-praxis.de/blog/2009/09/09/migration-zu-wicket-formulare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Datenbankeinträge auswählen mit der CheckGroup</title>
		<link>http://www.wicket-praxis.de/blog/2009/09/02/form-checkgroup-database/</link>
		<comments>http://www.wicket-praxis.de/blog/2009/09/02/form-checkgroup-database/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 22:00:45 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[checkgroup]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.wicket-praxis.de/blog/?p=102</guid>
		<description><![CDATA[Ich wurde gefragt, ob in meinem Buch (Praxisbuch Wicket) die Verwendung der CheckGroup-Komponente erläutert wird. Die Anwort ist einfach: ja. Was in dem Beispiel aber nicht gezeigt wird, ist das dynamische Erzeugen der Auswahlliste durch Daten aus einer Datenbank. Der Absender hat sich aber genau für diesen Fall interessiert, so dass ich an dieser Stelle [...]]]></description>
			<content:encoded><![CDATA[<p>Ich wurde gefragt, ob in meinem Buch (<a href="http://www.hanser.de/978-3-446-41909-4">Praxisbuch Wicket</a>) die Verwendung der CheckGroup-Komponente erläutert wird. Die Anwort ist einfach: ja.</p>
<p>Was in dem Beispiel aber nicht gezeigt wird, ist das dynamische Erzeugen der Auswahlliste durch Daten aus einer Datenbank. Der Absender hat sich aber genau für diesen Fall interessiert, so dass ich an dieser Stelle mal ein einfaches Beispiel geben möchte, wie man soetwas realisieren kann.</p>
<p><strong>Das Beispiel</strong></p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.web.blog.pages.questions.checkgroup.fromdb</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.WebPage</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.basic.Label</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.Check</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.CheckGroup</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.form.Form</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.list.ListItem</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.list.ListView</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.markup.html.panel.FeedbackPanel</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.model.LoadableDetachableModel</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.model.Model</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.model.util.CollectionModel</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.spring.injection.annot.SpringBean</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">de.wicketpraxis.persistence.beans.User</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">de.wicketpraxis.persistence.dao.UserDao</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CheckGroupFromDbPage <span style="color: #000000; font-weight: bold;">extends</span> WebPage</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;@SpringBean</li><li>&nbsp;&nbsp;UserDao _userDao<span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> CheckGroupFromDbPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;LoadableDetachableModel<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;&gt;</span> userListModel=<span style="color: #000000; font-weight: bold;">new</span> LoadableDetachableModel<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399; font-weight: bold;">List</span><span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;</span> load<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> _userDao.<span style="color: #006633;">findAll</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">final</span> IModel<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Collection</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Integer</span><span style="color: #339933;">&gt;&gt;</span> selectedModel = <span style="color: #000000; font-weight: bold;">new</span> CollectionModel<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Integer</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">ArrayList</span><span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Integer</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FeedbackPanel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;feedback&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;Form<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Void</span><span style="color: #339933;">&gt;</span> form=<span style="color: #000000; font-weight: bold;">new</span> Form<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Void</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;form&quot;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> onSubmit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;info<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Elemente selectiert: &quot;</span>+selectedModel.<span style="color: #006633;">getObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;CheckGroup<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Integer</span><span style="color: #339933;">&gt;</span> checkGroup=<span style="color: #000000; font-weight: bold;">new</span> CheckGroup<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Integer</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;checkGroup&quot;</span>,selectedModel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;form.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>checkGroup<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;checkGroup.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">ListView</span><span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;list&quot;</span>,userListModel<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #006600; font-weight: bold;">void</span> populateItem<span style="color: #009900;">&#40;</span>ListItem<span style="color: #339933;">&lt;</span>User<span style="color: #339933;">&gt;</span> item<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Check<span style="color: #339933;">&lt;</span><span style="color: #003399; font-weight: bold;">Integer</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;check&quot;</span>,Model.<span style="color: #006633;">of</span><span style="color: #009900;">&#40;</span>item.<span style="color: #006633;">getModelObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Label</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span>,item.<span style="color: #006633;">getModelObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;add<span style="color: #009900;">&#40;</span>form<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Und das Markup-File:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>CheckGroup from DB<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;feedback&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;wicket:container wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkGroup&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;wicket:container wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;list&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;check&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> wicket:<span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>wicket:container&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>wicket:container&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Auswählen&quot;</span>&gt;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></li><li><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Die Variable _userDao beinhaltet die Datenbankzugriffsklasse. Da wir die Variable als Field definiert haben, können wir ohne weiteres innerhalb der Klasse darauf zugreifen. Wicket sorgt für alle über die SpringBean-Annotation initialisierten Felder dafür, dass es mit der Serialisierung der Komponente keine Probleme gibt.</p>
<p>Als nächstes erstellen wir ein Modell, dass die gewünschte Auswahlmenge ermittelt. An dieser Stelle könnte man über ein CascadingLoadableDetachableModel (kein Wicket-Standard, siehe Buch Seite 65 oder hier im Blog) auch auf die Modelldaten eines Eingabefeldes zurückgreifen um die Abfrage einsprechende zu beeinflussen zu können. Das Ergebis ist eine Liste von Objekten.</p>
<p>Als zweiter erstellen wir ein Modell, in dem die IDs der ausgewählten Elemente landen. Um den Aufwand einer eigenen Implementierung einer Modellklasse für eine Collection von persistenten Objekten zu sparen, legen wir nur die ID des Elements, nicht das Element selbst in der Auswahlliste ab.</p>
<p>Das Feedbackpanel dient zur Anzeige die Message, die in der onSubmit-Methode des Formulars ausgegeben wird. Das Formular hat in diesem Fall kein eigenes Modell (nur der Einfachheit halber wird in dem Beispiel auf die Verwendung eines CompoundPropertyModel verzichtet).</p>
<p>Jetzt kommt der spannende Teil. Der CheckGroup-Komponente wird als Parameter das Modell übergeben, in der die Ausgewählten Elemente gesammelt werden sollen. Dann wird in der ListView für alle zur Verfügung stehenden Elemente eine Check-Komponente hinzugefügt, die als Modell nicht das Objekt, sondern die ID des Datenbankeintrags übergeben bekommt.</p>
<p><strong>Funktionsweise</strong></p>
<p>Wenn das Formular abgeschickt wird, ermittelt Wicket alle Check-Komponenten, die aktiviert waren. Für diese Komponenten wird der Inhalt des Modells ermittelt und der Auswahlliste hinzugefügt. Abschließend wird das Modell, dass die Auswahlliste beinhaltet entsprechend gesetzt. Dabei können beliebige Typen für die Auswahlliste benutzt werden, solange sie serialisierbar sind. Kommen die Daten aus einer Datenbank empfiehlt sich der Einsatz eines Primärschlüssels, anhand dessen das Objekt ermittelbar bleibt.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F02%2Fform-checkgroup-database%2F&amp;title=Datenbankeintr%C3%A4ge%20ausw%C3%A4hlen%20mit%20der%20CheckGroup&amp;bodytext=Ich%20wurde%20gefragt%2C%20ob%20in%20meinem%20Buch%20%28Praxisbuch%20Wicket%29%20die%20Verwendung%20der%20CheckGroup-Komponente%20erl%C3%A4utert%20wird.%20Die%20Anwort%20ist%20einfach%3A%20ja.%0D%0A%0D%0AWas%20in%20dem%20Beispiel%20aber%20nicht%20gezeigt%20wird%2C%20ist%20das%20dynamische%20Erzeugen%20der%20Auswahlliste%20durch%20Daten%20au" title="Digg"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F02%2Fform-checkgroup-database%2F" title="Sphinn"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F02%2Fform-checkgroup-database%2F&amp;title=Datenbankeintr%C3%A4ge%20ausw%C3%A4hlen%20mit%20der%20CheckGroup&amp;notes=Ich%20wurde%20gefragt%2C%20ob%20in%20meinem%20Buch%20%28Praxisbuch%20Wicket%29%20die%20Verwendung%20der%20CheckGroup-Komponente%20erl%C3%A4utert%20wird.%20Die%20Anwort%20ist%20einfach%3A%20ja.%0D%0A%0D%0AWas%20in%20dem%20Beispiel%20aber%20nicht%20gezeigt%20wird%2C%20ist%20das%20dynamische%20Erzeugen%20der%20Auswahlliste%20durch%20Daten%20au" title="del.icio.us"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F02%2Fform-checkgroup-database%2F&amp;t=Datenbankeintr%C3%A4ge%20ausw%C3%A4hlen%20mit%20der%20CheckGroup" title="Facebook"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F02%2Fform-checkgroup-database%2F&amp;title=Datenbankeintr%C3%A4ge%20ausw%C3%A4hlen%20mit%20der%20CheckGroup" title="Mixx"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F09%2F02%2Fform-checkgroup-database%2F&amp;title=Datenbankeintr%C3%A4ge%20ausw%C3%A4hlen%20mit%20der%20CheckGroup&amp;annotation=Ich%20wurde%20gefragt%2C%20ob%20in%20meinem%20Buch%20%28Praxisbuch%20Wicket%29%20die%20Verwendung%20der%20CheckGroup-Komponente%20erl%C3%A4utert%20wird.%20Die%20Anwort%20ist%20einfach%3A%20ja.%0D%0A%0D%0AWas%20in%20dem%20Beispiel%20aber%20nicht%20gezeigt%20wird%2C%20ist%20das%20dynamische%20Erzeugen%20der%20Auswahlliste%20durch%20Daten%20au" title="Google Bookmarks"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
<div id="vgwpixel"></div><h3  class="related_post_title">Andere Beiträge</h3><ul class="related_post"><li>5. Februar 2010 -- <a href="http://www.wicket-praxis.de/blog/2010/02/05/wicket-combined-autocomplete-behavoir/" title="Wicket &#8211; kombiniertes AutoCompleteBehavoir ">Wicket &#8211; kombiniertes AutoCompleteBehavoir </a></li><li>11. Dezember 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/12/11/wicket-form-submit-mit-und-ohne-ajax/" title="Wicket Form Submit &#8211; mit und ohne Ajax">Wicket Form Submit &#8211; mit und ohne Ajax</a></li><li>3. Oktober 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/10/03/datatable-vs-dataview-wicket-komponenten-wiederverwendet/" title="DataTable vs. DataView &#8211; Wicket-Komponenten wiederverwendet">DataTable vs. DataView &#8211; Wicket-Komponenten wiederverwendet</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wicket-praxis.de/blog/2009/09/02/form-checkgroup-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 23/84 queries in 0.082 seconds using disk: basic
Object Caching 1410/1465 objects using disk: basic

Served from: www.wicket-praxis.de @ 2012-02-06 20:05:22 -->
