Ok I solved it. I changed the line
User userSelected= (User) getModelObject(); to
User userSelected= (User) getParent().getModelObject();
The problem must have been no model set for link.
tsuresh wrote:
>
> Hello I have a list of users with links in class UserList. When I click
> the link I need to display the clicked name in another page
> (DisplayUser). My code snippet is as follows. When i click the link i get
> the error : No get method defined for class: class User expression: link.
> When I added get/set methods for link in User class ,it threw NPE. What
> should I do,please help?
>
> add(new PropertyListView("rows", userList) {
>
> protected void populateItem(ListItem item) {
> User user= (User) item.getModelObject();
> item.add(new Link("link") {
>
> public void onClick() {
> User userSelected= (User) getModelObject();
> setResponsePage(new
> DisplayUser(userSelected.getUserName()));
> }
> }.add(new Label("name", user.getUserName())));
> }
> });
> }
>
--
View this message in context:
http://www.nabble.com/Pass-page-parameters-tp14782931p14783279.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]