Returning page's class in a handler method you tell Tapestry where to
navigate to, but yor target page needs a context. Just create a Link
with context and return it instead of class.
25.07.2011, в 19:06, Julien Martin <bal...@gmail.com> написал(а):
Hello,
I have a page that lists job postings (beans) as follows:
Template:
*<t:recruiters.recruiterslayout xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
<form t:type="form" t:id="jobPostings">
<t:grid source="jobPostings" row="jobPosting"
add="activate,modify"
exclude="jobPostingValidationDate">
<p:activatecell>
<t:actionlink t:id="activate"
context="jobPosting.idJobPosting">activate</t:actionlink>
</p:activatecell>
<p:modifycell>
<t:actionlink t:id="modify"
context="jobPosting.idJobPosting">modify</t:actionlink>
</p:modifycell>
</t:grid>
</form>
</t:recruiters.recruiterslayout>
*
Java:
*package com.cheetah.web.pages.recruiters;
import com.cheetah.domain.JobPosting;
import com.cheetah.service.CheetahService;
import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.PageActivationContext;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import java.util.Date;
import java.util.List;
public class JobPostingsTable {
@Property
private List<JobPosting> jobPostings;
@PageActivationContext
@Property
private JobPosting jobPosting;
@Property
private Date date;
@Inject
private CheetahService service;
@OnEvent(EventConstants.ACTIVATE)
void loadJobPostings() {
jobPostings = service.loadJobPostings();
}
@OnEvent(EventConstants.ACTION)
void activateJobPosting() {
}
@OnEvent(value = EventConstants.ACTION, component = "modify")
Object modifyJobPosting() {
return ModifyJobPosting.class;
}
}*
However, when I click on the action link with t:id="modify", the job
posting
id is lost... and the ModifyJobPosting page is not able to display
the bean.
Template for ModifyJobPosting:
*<t:recruiters.recruiterslayout xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
<t:beandisplay object="jobPosting" />
</t:recruiters.recruiterslayout>*
java for ModifyJobPosting:
*public class ModifyJobPosting {
@PageActivationContext
@Property
private JobPosting jobPosting;
}*
I must be missing something obvious about PageActivationContext
usage. Can
anyone please help?
Regards,
Julien.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org