So now my OnGet looks like :
@Override
public void onGet() {
super.onGet();
customerName = getContext().getRequest().getUserPrincipal().getName();
id = getContext().getRequest().getParameter("id");
try {
printCustomerEnt = dashboardSBBeanLocal.findCustomer(customerName);
if (StringUtils.isNotBlank(id)) {
printProviderMockEnt =
dashboardSBBeanLocal.getPrintProviderMock(Long.parseLong(id));
form.copyFrom(printProviderMockEnt);
form.exception.setValue(""+printProviderMockEnt.getException().getId());
form.printProviderMockEntId.setValueObject(printProviderMockEnt.getId());
} else {
newTestPrintProvider = true;
}
} catch (BusinessException e) {
addModel("error", e.getMessage());
return;
} catch (SystemException e) {
// TODO show errorpage
logger.error(e.getMessage(), e);
}
}

And now it is working. :)

What when the user can choose multiple exceptions... ??
setSelectedValues maybe... but that takes a list of Strings... and my
Select uses Long. ??






On Mon, May 20, 2013 at 11:43 AM, Bob Schellink <[email protected]> wrote:

>  On 2013/05/20 18:44, Kristian Lind wrote:
>
> To try this I made a method
> public PrintProviderExceptionMockEnt getException() {
>  That just returns the first and only exception in the list..
>
>  and change my Select to...
>
>  // Select exception
> exception = new Select("exception", true);
>
>  But nothing is happening :(
>
>
> Correct. The Select is populated with Options as follow:
>  options.add(new Option(printProviderExceptionMockEnt.getId() ....);
>
> By setting the selected value to a PrintProviderExceptionMockEnt, Click
> will just call toString on it. The Select control isn't smart enough to
> know about the PrintProviderExceptionMockEnt,getId() method.
>
> So basically you just need to set the value yourself. So after this line:
>   form.copyFrom
>
> do this:
> form.exception.setValue(someIdOfAnException);
>
> regards
>
> Bob
>



-- 
Best regards

Kristian Lind

Reply via email to