You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Magne Skjeret <ma...@broadpark.no> on 2003/07/19 01:08:56 UTC

pre formatted text

Greetings

I am currently in a process going trough my project, to see if velocity
can serve my needs.

Up to now it seems very good, and I really love working with it.

One concern I have now is that I can get preformatted text from the
server I access from my webapp. I thought of course that trowing a pre
tag around would make everybody happy. But no, the suits didnt like it.

So it seems like they dont want to have monospace font and no word-wrap.
I argued that they are missing the point of CDATA/preformat if they dont
use monospace fonts. Well, the matter is setteled; I lost, and I just
have to live with it.

So what they want is to keep all whitespaces and lineshifts intact.
Earlier when working with jsp, I just inserted e.g " &nbsp,&nbsp;<br>"
for spaces and shifts to emulate this.

But I am sure that I read in the list some weeks ago, that it wasnt
possible to give html code to the template, as the tags would be
escaped. Am I right?

So is there a way velocity can help me doing this (translate lineshifts
and spaces) to valid html?

Magne Skjeret

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


Accessing to request object

Posted by Guillermo Meyer <gm...@sib.interbanking.com.ar>.
Hi:
This is a simple question. I'm new on Velocity.
I want to access to a request attribute from a Velocity template:

in a servlet I set an attribute:
request.serAttribute("propertyName", "nameXX");

in velocity I want to access this attribute value::
$request.getAttribute("propertyName")

but this doesn't work.

Can anyone tell me the syntax I should use?

Thanks in advance.
Guillermo.


Accessing to request object

Posted by Guillermo Meyer <gm...@sib.interbanking.com.ar>.
Hi:
This is a simple question. I'm new on Velocity.
I want to access to a request attribute from a Velocity template:

in a servlet I set an attribute:
request.serAttribute("propertyName", "nameXX");

in velocity I want to access this attribute value::
$request.getAttribute("propertyName")

but this doesn't work.

Can anyone tell me the syntax I should use?

Thanks in advance.
Guillermo.


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


Re: pre formatted text

Posted by Magne Skjeret <ma...@broadpark.no>.
l?, 19.07.2003 kl. 13.25 skrev Jim Seach:
> --- Magne Skjeret <ma...@broadpark.no> wrote:
> > l?, 19.07.2003 kl. 04.00 skrev Barbara Baughman:
> > > I use &nbsp; in velocity templates that create HTML with no
> > problems.
> > > Velocity shouldn't change anything in your template unless it is a
> > > valid reference to $something.
> > 
> >   But it will change <br> to &lt;br&gt; right?
> > So the real problem would be to keep lineshifts, and not spaces.
> 
> Velocity by default will not do any HTML escaping, either on the
> template text or on the contents of references.  IIRC, the discussion
> was about how to make it do such escaping when appropriate.

  Ah. Thanks a lot. I guess I should have tested before I created a
non-exstistent problem.

Magne

> > 
> > Magne
> > 
> > > Barbara Baughman
> > > X2157
> > > 
> 
> Jim Seach
> 
> > > On Fri, 19 Jul 2003, Magne Skjeret wrote:
> > > 
> > > > Greetings
> > > >
> > > > I am currently in a process going trough my project, to see if
> > velocity
> > > > can serve my needs.
> > > >
> > > > Up to now it seems very good, and I really love working with it.
> > > >
> > > > One concern I have now is that I can get preformatted text from
> > the
> > > > server I access from my webapp. I thought of course that trowing
> > a pre
> > > > tag around would make everybody happy. But no, the suits didnt
> > like it.
> > > >
> > > > So it seems like they dont want to have monospace font and no
> > word-wrap.
> > > > I argued that they are missing the point of CDATA/preformat if
> > they dont
> > > > use monospace fonts. Well, the matter is setteled; I lost, and I
> > just
> > > > have to live with it.
> > > >
> > > > So what they want is to keep all whitespaces and lineshifts
> > intact.
> > > > Earlier when working with jsp, I just inserted e.g "
> > &nbsp,&nbsp;<br>"
> > > > for spaces and shifts to emulate this.
> > > >
> > > > But I am sure that I read in the list some weeks ago, that it
> > wasnt
> > > > possible to give html code to the template, as the tags would be
> > > > escaped. Am I right?
> > > >
> > > > So is there a way velocity can help me doing this (translate
> > lineshifts
> > > > and spaces) to valid html?
> > > >
> > > > Magne Skjeret
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > velocity-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> > > >
> > > >
> > > 
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> > > 
> > > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 

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


Re: pre formatted text

Posted by Jim Seach <jw...@yahoo.com>.
--- Magne Skjeret <ma...@broadpark.no> wrote:
> l?, 19.07.2003 kl. 04.00 skrev Barbara Baughman:
> > I use &nbsp; in velocity templates that create HTML with no
> problems.
> > Velocity shouldn't change anything in your template unless it is a
> > valid reference to $something.
> 
>   But it will change <br> to &lt;br&gt; right?
> So the real problem would be to keep lineshifts, and not spaces.

Velocity by default will not do any HTML escaping, either on the
template text or on the contents of references.  IIRC, the discussion
was about how to make it do such escaping when appropriate.

> 
> Magne
> 
> > Barbara Baughman
> > X2157
> > 

Jim Seach

> > On Fri, 19 Jul 2003, Magne Skjeret wrote:
> > 
> > > Greetings
> > >
> > > I am currently in a process going trough my project, to see if
> velocity
> > > can serve my needs.
> > >
> > > Up to now it seems very good, and I really love working with it.
> > >
> > > One concern I have now is that I can get preformatted text from
> the
> > > server I access from my webapp. I thought of course that trowing
> a pre
> > > tag around would make everybody happy. But no, the suits didnt
> like it.
> > >
> > > So it seems like they dont want to have monospace font and no
> word-wrap.
> > > I argued that they are missing the point of CDATA/preformat if
> they dont
> > > use monospace fonts. Well, the matter is setteled; I lost, and I
> just
> > > have to live with it.
> > >
> > > So what they want is to keep all whitespaces and lineshifts
> intact.
> > > Earlier when working with jsp, I just inserted e.g "
> &nbsp,&nbsp;<br>"
> > > for spaces and shifts to emulate this.
> > >
> > > But I am sure that I read in the list some weeks ago, that it
> wasnt
> > > possible to give html code to the template, as the tags would be
> > > escaped. Am I right?
> > >
> > > So is there a way velocity can help me doing this (translate
> lineshifts
> > > and spaces) to valid html?
> > >
> > > Magne Skjeret
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> > >
> > >
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 


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


Re: pre formatted text

Posted by Magne Skjeret <ma...@broadpark.no>.
l?, 19.07.2003 kl. 04.00 skrev Barbara Baughman:
> I use &nbsp; in velocity templates that create HTML with no problems.
> Velocity shouldn't change anything in your template unless it is a
> valid reference to $something.

  But it will change <br> to &lt;br&gt; right?
So the real problem would be to keep lineshifts, and not spaces.

Magne

> Barbara Baughman
> X2157
> 
> On Fri, 19 Jul 2003, Magne Skjeret wrote:
> 
> > Greetings
> >
> > I am currently in a process going trough my project, to see if velocity
> > can serve my needs.
> >
> > Up to now it seems very good, and I really love working with it.
> >
> > One concern I have now is that I can get preformatted text from the
> > server I access from my webapp. I thought of course that trowing a pre
> > tag around would make everybody happy. But no, the suits didnt like it.
> >
> > So it seems like they dont want to have monospace font and no word-wrap.
> > I argued that they are missing the point of CDATA/preformat if they dont
> > use monospace fonts. Well, the matter is setteled; I lost, and I just
> > have to live with it.
> >
> > So what they want is to keep all whitespaces and lineshifts intact.
> > Earlier when working with jsp, I just inserted e.g " &nbsp,&nbsp;<br>"
> > for spaces and shifts to emulate this.
> >
> > But I am sure that I read in the list some weeks ago, that it wasnt
> > possible to give html code to the template, as the tags would be
> > escaped. Am I right?
> >
> > So is there a way velocity can help me doing this (translate lineshifts
> > and spaces) to valid html?
> >
> > Magne Skjeret
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 

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


Re: pre formatted text

Posted by Barbara Baughman <ba...@utdallas.edu>.
I use &nbsp; in velocity templates that create HTML with no problems.
Velocity shouldn't change anything in your template unless it is a
valid reference to $something.

Barbara Baughman
X2157

On Fri, 19 Jul 2003, Magne Skjeret wrote:

> Greetings
>
> I am currently in a process going trough my project, to see if velocity
> can serve my needs.
>
> Up to now it seems very good, and I really love working with it.
>
> One concern I have now is that I can get preformatted text from the
> server I access from my webapp. I thought of course that trowing a pre
> tag around would make everybody happy. But no, the suits didnt like it.
>
> So it seems like they dont want to have monospace font and no word-wrap.
> I argued that they are missing the point of CDATA/preformat if they dont
> use monospace fonts. Well, the matter is setteled; I lost, and I just
> have to live with it.
>
> So what they want is to keep all whitespaces and lineshifts intact.
> Earlier when working with jsp, I just inserted e.g " &nbsp,&nbsp;<br>"
> for spaces and shifts to emulate this.
>
> But I am sure that I read in the list some weeks ago, that it wasnt
> possible to give html code to the template, as the tags would be
> escaped. Am I right?
>
> So is there a way velocity can help me doing this (translate lineshifts
> and spaces) to valid html?
>
> Magne Skjeret
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

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