velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryce Nesbitt <bry...@obviously.com>
Subject Re: How to output a tab from a velocity template?
Date Thu, 15 Dec 2005 02:08:39 GMT
Nathan Bubna wrote:
>    if actual tabs aren't icky in the output, then i don't see why they're
> icky in the input.  Velocity doesn't do anything special for or with
> tab characters.
Because the source code is in a multiplatform multideveloper environment
that does not preserve (or allow,
or tolerate) tabs.
The export is in user-land.

>   if you want a tab character in the output, the
> simplest thing is to put it in the input.  but if you really don't
> like that, you can always put a string containing just a tab in the
> context:
>
> context.put("tab", "\t");
>
> and then use
>
> ${tab} in your template.
>
>   
Cool, could you give me one more hint on where to find the right
context? I did this, without joy:


 // Action.java
...extends ActionSupport...

 public String execute() throws Exception {
        ActionContext.getContext().put("tab","\t");
        return "tabexport";
    }


<!-- something.vm -->
$res.setHeader("content-type", "text/plain")
$res.setHeader("Content-Disposition", "attachment;
filename=cust_-xxxxxx.txt")TFLD4
TEST$tab${tab}TEST
TEST$tab${tab}TEST

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message