Source Viewer : WEB-INF/classes/org/apache/click/examples/page/general/PageActionLink.java
package org.apache.click.examples.page.general;
import org.apache.click.ActionResult;
import org.apache.click.control.PageLink;
import org.apache.click.examples.page.BorderPage;
/**
* Provides a PageAction demo. The PageLink sets a PAGE_ACTION to the page method
* 'getDate'. Clicking on the PageLink will invoke the 'getDate' method and render
* the ActionResult.
*/
public class PageActionLink extends BorderPage {
private static final long serialVersionUID = 1L;
private PageLink link = new PageLink("link", "Get Date", PageActionLink.class);
public PageActionLink() {
addControl(link);
// We set a PAGE_ACTION to invoke the getDate method below
link.setParameter(PAGE_ACTION, "getDate");
}
/**
* This method will be invoked when the link is clicked.
*/
public ActionResult getDate() {
return new ActionResult(format.currentDate("MMM dd, yyyy HH:MM:ss"));
}
}