The simplest solution is to return a StreamResponse from your page's onActivate
event. You won't need a template (.tml) to do this.
Object onActivate(EventContext context) {
return new TextStreamResponse("text/plain", "welcome");
}
Since plain text isn't a great solution, you'll probably want to use JSON instead.
Object onActivate(EventContext context) {
JSONObject json = new JSONObject("greeting", "welcome");
return new TextStreamResponse("application/json", json.toCompactString());
}
For a simple way of creating restful webservices in tapestry, you might want to consider tapestry-resteasy