Hyperlinks and action methods
Hyperlinks and action methods
- Subject: Hyperlinks and action methods
- From: "Chris Meyer" <email@hidden>
- Date: Sun, 30 Mar 2008 19:44:23 -0700
One pattern I find myself using often is that I have a page listing my objects (PeopleList) and a detail page (PersonDetail).
In my PeopleList component, I have a WORepetition of WOHyperlink's linking to specific PersonDetails.
To facilitate the hyperlink, I have an action in PeopleList.java that creates a new PeopleDetail page and sets the iterated Person in the WORepetition into a variable on that new page.
My questions:
Is this the right design pattern to use?
If so, is there any way to use ognl or some other mechanism to avoid writing the action method in PeopleList.java that loads the new page and sets the Person variable on the new page?
If not, is there any fundamental reason why this cannot be done automatically (with some syntax modifications/improvements in the WOParser, or whatever)?
PeopleList.wo:
<ul>
<wo:WORepetition list="people" item="person">
<li><wo:WOHyperlink action="" value="$person.name"/></wo:WOHyperlink></li>
</wo:WORepetition>
</ul>
PeopleList.java
class PeopleList
{
public Person person;
// can this be avoided?
public WOComponent gotoPersonDetail()
{
PersonDetail pd = (PersonDetail)pageWithName(PersonDetail.class.getSimpleName());
pd.person = person;
return pd;
}
}
PersonDetail.java
class PersonDetail
{
public Person person;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden