Hi,
As an example, you want to have a drop down list for selecting country.
Your java will have
public abstract class DetailsPage extends BasePage
implements PageRenderListener
{
public abstract String getCountry();
public abstract void setCountry(String _value);
public IPropertySelectionModel getCountries()
{
// only 4 countries here for the sake of example
return new StringPropertySelectionModel(new String[]
{"Algeria", "France", "Germany", "U.A.E", "U.S.A"});
}
public void pageBeginRender(PageEvent event)
{
if (!event.getRequestCycle().isRewinding())
{
// this is not form submit
// the countries drop list will show Germany when html page
// appears in the browser
this.setCountry("Germany");
}
}
public void formSubmit(IRequestCycle cycle) {
// Process form submission
String countrySelected = getCountry();
..
}
}
In your html file
<form jwcid="@Form" listener="ognl:listeners.formSubmit">
Country: <span jwcid="@PropertySelection"
model="ognl:countries" value="ognl:country"/>
</form>
In your .page file
<property-specification name="country" type="java.lang.String"/>
Hope this helps
Sohail Aslam
sohail dot aslam at google mail dot com
Voors Paul wrote:
Thank you much for the fast reply.
From your reply i can not make up where to put the setValue(2) method.
Paul
Pedro Maria Buitrago Mantilla (12/14/2005 15:16):
<span jwcid="[EMAIL PROTECTED]" value="ognl:value"
model="ognl:modelValue">
Supongamos modelValue = {1,2,3,4}
In the class, PageBeginRender by example ----
setValue(2);
On 14 Dec 2005 15:06:00 +0100, Voors Paul <[EMAIL PROTECTED]> wrote:
Hello all,
I am using a PropertySelection component. Is it possible to set an option
selected?
I can not find anything about it in the documentation,
greetings,
Paul Voors
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]