You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by RIBEIRO Paulo Jorge <pr...@enabler.pt> on 2002/04/05 16:33:33 UTC

2 questions

Hello all,

I'm a Velocity newbie and I need some help in two problems:

1- I'm using a template to a "one" line string. Because my template is huge,
it is not very easy to work with it. My question is if there is any way to
avoid the new line characters from the template file to the output. For
example, if I have "$firstvalue$secondvalue$thirdvalue" template can I
define the template like
$firstvalue
$secondvalue
$thirdvalue
Having the merge result in just one line.

2- It is possible to disable the Velocity log? If yes, How can I do it.

Thanks,

Paulo Moreira

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 2 questions

Posted by Christoph Reck <Ch...@dlr.de>.
Bom dia,

RIBEIRO Paulo Jorge wrote:
> 
> Hello all,
> 
> I'm a Velocity newbie and I need some help in two problems:
> 
> 1- I'm using a template to a "one" line string. Because my template is huge,
> it is not very easy to work with it. My question is if there is any way to
> avoid the new line characters from the template file to the output. For
> example, if I have "$firstvalue$secondvalue$thirdvalue" template can I
> define the template like
> $firstvalue
> $secondvalue
> $thirdvalue
> Having the merge result in just one line.

Use the onle-line-comments to escape the EOL:
$firstvalue##
$secondvalue##
$thirdvalue##
## no EOL at the end of the file

> 
> 2- It is possible to disable the Velocity log? If yes, How can I do it.

I have a command line argument that selects the logger:
      if( args[i].equals("-quiet") )
        logger = "org.apache.velocity.runtime.log.NullLogSystem";
      else if( args[i].equals("-verbose") )
        logger = "...path.to.the.package...StderrLogSystem";
      ....
taken from:
http://cvs.apache.org/viewcvs/jakarta-velocity/contrib/temporary/stderrlogsystem/StderrLogSystem.java?rev=1.1

and tell the VE to use it:
      velocity = new VelocityEngine();
      velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, logger);
before 
      velocity.init();

Or you can configure it in velocity.properties

> 
> Thanks,
> 
> Paulo Moreira
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

Saludos,
:) Christoph Reck

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 2 questions

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/5/02 9:33 AM, "RIBEIRO Paulo Jorge" <pr...@enabler.pt> wrote:

> Hello all,
> 
> I'm a Velocity newbie and I need some help in two problems:
> 
> 1- I'm using a template to a "one" line string. Because my template is huge,
> it is not very easy to work with it. My question is if there is any way to
> avoid the new line characters from the template file to the output. For
> example, if I have "$firstvalue$secondvalue$thirdvalue" template can I
> define the template like
> $firstvalue
> $secondvalue
> $thirdvalue
> Having the merge result in just one line.

Well... You could strip the characters out, or use a stream filter somehow,
I guess.

> 
> 2- It is possible to disable the Velocity log? If yes, How can I do it.

Not really disable, but you can force it to log into nothingness.

Assuming using the VelocityEngine rather than the Velocity singleton
(although the method calls are the same)

  ve.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM_CLASS,
      "org.apache.velocity.runtime.log.NullLogSystem" );

Before ve.init().

-- 
Geir Magnusson Jr.                                      geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>