📜 ⬆️ ⬇️

Wicket: HelloWorld

Recently I started exploring the wonderful Wicket framework. Unfortunately, there is very little information about him in runet and therefore here I would like to show you some of his features. And for one and write to not forget.
Wicket is a framework for writing user interfaces for web applications, which allows the vast majority of tasks to be implemented in java. More details about all its benefits are written on offsite . There are also examples there, but I personally didn’t like them very much, so I’m recommending that I recommend looking through a book (in English) called “Wicket in action” (I’m hardly going to translate it completely, but I’ll show you some goodies). And now actually to the point. To create a project (I use maven) we will write a simple spell

mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.4.7 -DgroupId=ru.habrahabr.helowicket -DartifactId=helloworld

which will create a project. As a result, we get a project with 3 files: a file with a talking name WicketApplication.java,
package ru.habrahabr.helowicket;<br><br>import org.apache.wicket.protocol.http.WebApplication;<br><br> public class WicketApplication extends WebApplication<br>{ <br> public WicketApplication()<br> {<br> }<br> public Class<HomePage> getHomePage()<br> {<br> return HomePage. class ;<br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter .
as well as HomePage.html and HomePage.java files containing the corresponding markup and page logic (files must have the same name and different extensions).
HomePage.html
< html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < strong > Wicket Quickstart Archetype Homepage </ strong > <br> < br />< br /> <br> < span wicket:id ="message" > message will be here </ span > <br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter .

HomePage.java
package ru.habrahabr;<br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.markup.html.WebPage;<br><br> public class HomePage extends WebPage {<br><br> private static final long serialVersionUID = 1L;<br><br> public HomePage(final PageParameters parameters) {<br> add( new Label( "message" , "If you see this message wicket is properly configured and running" ));<br> }<br>} <br><br> * This source code was highlighted with Source Code Highlighter .
I think the meaning is clear, but in 2 words I will comment. The markup file contains the line
< span wicket:id ="message" > message will be here </ span > <br><br> * This source code was highlighted with Source Code Highlighter .
so that in java code it becomes possible to access this element using the string
add(new Label("message", "If you see this message wicket is properly configured and running"));
after which we can manipulate this object. That is, using attributes (wicket: id), the markup tags are compared with objects created when the application is running on the server side.

add(new Label("message", new Date().toString()));

Notice that we will not see the "message will be here" from the markup file. How it works we can see by clicking the magic button in your favorite IDE. To open a project, for example, in eclipse, use the mvn eclipse:eclipse -DdownloadSources=true in the project directory. The full list of spells is on the Wicket site. You can do it easier by typing: mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .
mvn tomcat:run .
AJAX. , . : < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < head > <br> < title > Wicket Quickstart Archetype Homepage </ title > <br> </ head > <br> < body > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ body > <br> </ html > <br> <br> * This source code was highlighted with Source Code Highlighter . . label link . java : public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br> <br> * This source code was highlighted with Source Code Highlighter . label . link . , PropertyModel (this) "time", . .

" ". SiteMech , Wicket . , - <wicket:child/> <wicket:extend> . java ( BasePage) HomePage. :
BasePage.html < html xmlns:wicket ="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <br> < body > <br> < div > <br> <!-- --> <br> < span wicket:id ="bpspan" ></ span > <br> < wicket:child /> <br> <!-- - --> <br> </ div > <br> </ body > <br> </ html > <br><br> * This source code was highlighted with Source Code Highlighter .
BasePage.java package ru.habranabr.helowicket;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.markup.html.WebPage;<br>import org.apache.wicket.markup.html.basic.Label;<br><br> /** <br> * @author office <br> */ <br> public class BasePage extends WebPage {<br><br> public BasePage(final PageParameters parameters) {<br> super(parameters);<br> add( new Label( "bpspan" , "Hello from BasePage!" ));<br> }<br>}<br><br> <br> * This source code was highlighted with Source Code Highlighter .
HomePage.html < wicket:extend > <br> < a href ="#" wicket:id ="link" > This link </ a > has been clicked<br> < span wicket:id ="label" > 123 </ span > times.<br> </ wicket:extend > <br><br> * This source code was highlighted with Source Code Highlighter .
HomePage.java import java.util.Date;<br><br>import org.apache.wicket.PageParameters;<br>import org.apache.wicket.ajax.AjaxRequestTarget;<br>import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;<br>import org.apache.wicket.markup.html.basic.Label;<br>import org.apache.wicket.model.PropertyModel;<br><br> public class HomePage extends BasePage {<br><br> private static final long serialVersionUID = 1L;<br> private Label label;<br> private String time;<br> <br> public HomePage(final PageParameters parameters) {<br> super(parameters);<br> add( new AjaxFallbackLink( "link" ) { <br> @Override<br> public void onClick(AjaxRequestTarget target) { <br> time = new Date().toString();<br> if (target != null ) { <br> target.addComponent(label); <br> }<br> }<br> });<br> label = new Label( "label" , new PropertyModel( this , "time" ));<br> label.setOutputMarkupId( true );<br> add(label);<br> <br> }<br>}<br> <br> * This source code was highlighted with Source Code Highlighter . . - Wicket', , .

PS. , .

')

Source: https://habr.com/ru/post/89642/


All Articles