Shawn Church wrote:
ExternalLink is used to provide a URL which may be used outside the
context of a Tapestry webapp to link back into the webapp.  [ ... ]

See, I told you I was a newbie!  :-)

I think what you are wanting is to provide links to external
(non-Tapestry) applications from within a Tapestry app.

Exactly.

                                                         There are many
ways to do this, but two common ways are to either use the @Any
component to build the URL within your .html (or .page) directly, or a
possibly cleaner way is to build the URL strings within your .java page
handler.


Using the @Any solution:

<a jwcid="@Any" href='ognl: "http://maps.yahoo.com/maps_result?addr="; +
location.address.line + "&csz=" + location.address.city'> Yahoo Map </a>

Thank you.  The @Any solution is perhaps what I was looking for.


Using the .java method solution:

public String getYahooUrl()
{
   String url = "http://maps.yahoo.com/maps_result";;
   url += "?addr=" + getLocation().getAddress().getLine();
   url += "&csz=" + getLocation().getAddress().getCity();
   return url;
}

<span jwcid="@Insert" value="ognl:yahooUrl" raw="ognl:true"/>

I'm not certain about this Java method. It seems to me that it would just output the URL into the document. Is there a way to get this into an href attribute?

The other question about the Java method is whether this is considered good practice in Tapestry. It seems to me a matter of moving presentation data out to the template and back into the Java code, which seems counter to most other MVC systems I've seen, especially as I would need to add methods for every new URL format needed.

So when you say that this is "possibly cleaner", is the Tapestry experience that it's better to keep the templates clean and offload some formatting into Java? I'm surprised if this is the case, but would love to hear the arguments in favor of it.

Thank you very much for your helpful response.

  -- Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to