Hi Petri, To generate a DirectLink href programmatically, you'll need a class that implements IDirect. In the trigger() method on that, you can call the intended listener. Refer to an instance of the class implementing IDirect for the first parameter of DirectServiceParameter, set the Direct engine service on it (@InjectObject("engine-service:direct") or with a setter for a regular service), and create the href portion like this:
public String getDirectHref() { Object[] params = new Object[] { param1, param2, etc }; DirectServiceParameter dsParam = new DirectServiceParameter(this, params); ILink link = directService.getLink(false, dsParam); return link.getURL(); } HTH Ben On Tue, Mar 18, 2008 at 8:45 AM, Petri Wessman <[EMAIL PROTECTED]> wrote: > Hello all, I have a new question. I'd need to generate a > DirectLink-style link from inside Java code (render method); in other > words, generate HTML that would duplicate the effect of this: > > <a jwcid="@DirectLink" listener="listener:someAction" > parameters="ognl:someId">link text</a> > > from a Java code method which has access to a IMarkupWriter object (and > the IPage, if needed). > > Any tips on how to do this? I tried browsing the DirectLink.java source, > but the N levels of abstraction there mostly just gave me a headache :}. > > The reason I need to do this is: I need to generate a listing of > "events" for a system. Some of those events will contain various system > object IDs, and I need to make those IDs into links that will point to > detail on the specific ID. There may be more than one link per line, or > none. > > So I'd have stuff like: > > * something happened > * something else happened to item XXX > * used requested item XXX to me merged with other type of item YYY > > and I'd like to make those XXX and YYY parts into links that would lead > to a detail page on the given system object. The actual text is > localized (comes from page.getMessages()). > > The only way I've figured to do this is to use a @Delegator object and > roll up my own renderer for the item line HTML.. but now I'm stumped at > the "how do I generate a Tapestry link from within code" step. > > All help and pointers much appreciated :} > > //Petri > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]