You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "ssprasad.e" <ss...@gmail.com> on 2011/06/22 10:03:07 UTC
how to create a textfield dynamically
hi,
i want to generate components dynamically using java program in wicket.
[code=java]
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.PropertyModel;
public class CounterExample extends WebPage {
private int counter=0;
public CounterExample(){
add(new Link("link"){
@Override
public void onClick() {
if(counter<3){
counter++;
//add(new TextField("counter"+counter)); // 1
}
System.out.println(counter);
// TODO Auto-generated method stub
}}
);
if(counter<=3){
add(new Label("counter",new PropertyModel(this, "counter")));
}
}
}
[/code]
at line no: 1,i want to write a code to generate text field in html.
please help me :(
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-create-a-textfield-dynamically-tp3616289p3616289.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to create a textfield dynamically
Posted by Martin Grigorov <mg...@apache.org>.
You should use a repeater and add the text field to it.
See RepeatingView.
On Wed, Jun 22, 2011 at 11:03 AM, ssprasad.e <ss...@gmail.com> wrote:
> hi,
>
> i want to generate components dynamically using java program in wicket.
>
> [code=java]
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.form.TextField;
> import org.apache.wicket.markup.html.link.Link;
> import org.apache.wicket.model.PropertyModel;
>
> public class CounterExample extends WebPage {
> private int counter=0;
>
> public CounterExample(){
>
> add(new Link("link"){
>
> @Override
> public void onClick() {
> if(counter<3){
> counter++;
> //add(new TextField("counter"+counter)); // 1
>
> }
> System.out.println(counter);
> // TODO Auto-generated method stub
>
> }}
> );
> if(counter<=3){
> add(new Label("counter",new PropertyModel(this, "counter")));
> }
>
>
>
> }
>
> }
>
>
>
>
> [/code]
>
>
> at line no: 1,i want to write a code to generate text field in html.
> please help me :(
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-create-a-textfield-dynamically-tp3616289p3616289.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org