no you don't have to change them

if you are using wicket 1.0 make youre IChoice implementation (inside youre IChoiceList implementation)
and on the getDisplayName() for gender == 1 you return male
and for getIdValue() you return the 1

in 1.1 you just have to implement a IChoiceRender this one has also just displayvalue and idvalue methods.

johan


frank bengtsson wrote:
public class mypojo {

	private int gender;

	public setGender(int gender) {
		this.gender = gender;
	}

	public int getGender() {
		return gender
	}
}

this pojo cannot/must not be changed. du you follow ?
i think you say, that i have to change my pojo to have 2 fields ? 

/Frank

On Tuesday 12 July 2005 23:09, Johan Compagner wrote:
  
why would you change the pojos?
what do they look like now?
They have a name i take?

frank bengtsson wrote:
    
Problem is, i cant change the pojo's. So i think it will be simpler to get
the selection value(String) and manually convert to an int and then set
it on my pojo

agree ?

/Frank

On Tuesday 12 July 2005 22:37, Johan Compagner wrote:
      
with Wicket 1.0 you have to create 2 Choice object for the IChoiceList
imlementation.

In wicket 1.1 (the current cvs)  you could do this:

new DropDownChoice("gender",new Model(),new
ChoiceRenderer("name","id"),list);

and in that list you have 2 pojo's that have a getId() and a getName()

johan

frank bengtsson wrote:
        
Hi there,

I have "Male" + "Female" in my dropdownchoice and they are represented
as int's in my pojo's. How do i get "Male" converted to an int with
value 1 ?

Is there a way to set a number for each list item instead of returning
the list item("Male") ?

Or do i have to make a model for that dropdown, which then returns and
int for the get method and takes a string for the set method ?

/Frank
          
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar
happening July 14 at 8am PDT/11am EDT. We invite you to explore the
latest in dual core and dual graphics technology at this free one hour
event hosted by HP, AMD, and NVIDIA.  To register visit
http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
        

  

Reply via email to