You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "White, Tim" <Ti...@qwest.com> on 2008/05/02 22:42:28 UTC

#set to the result of a #parse?

Hi there -
 
 Just curious if there is a way to do somthing like this:
 
 #set ($processFullInfo = #parse("fullInfoYesNo.vm"))
 
The idea being that fullInfoYesNo.vm contains YES or NO.
 
I know I can put the whole #set into the #parsed file, but other
processes are using that same file, and need it to be just YES or NO.
 
Thanks,
 
Tim


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

Re: #set to the result of a #parse?

Posted by Nathan Bubna <nb...@gmail.com>.
On Fri, May 2, 2008 at 3:30 PM,  <sc...@accenture.com> wrote:
> Is there any way to #parse a string variable rather than a file?
>
>  I have a java class that passes a string with in-line references, like so:
>
>  $refstring = "The beverage I like is ${beverage}."
>
>  The $beverage variable is populated before this point in the script, but when I return the $refstring variable it is displayed unparsed. How is #parse used to make Velocity re#parse a string variable?

#parse doesn't do this.  in all currently released versions of
Velocity, you have to use something like the RenderTool
(http://velocity.apache.org/tools/releases/1.4/generic/RenderTool.html).
 In Velocity 1.6, there will be a new directive that you will be able
to use like this:  #evaluate( $refstring )


>  Thank you,
>
>  Scott Grunewald
>  scott.grunewald@accenture.com
>  AIM: ScottGrunewald
>  Office #: 905-804-6942
>
>  ________________________________
>
>  From: White, Tim [mailto:Tim.White@qwest.com]
>  Sent: Fri 5/2/2008 5:08 PM
>  To: Velocity Users List
>  Subject: RE: #set to the result of a #parse?
>
>
>
>
>
>  D'oh!
>
>  -----Original Message-----
>  From: Nathan Bubna [mailto:nbubna@gmail.com]
>  Sent: Friday, May 02, 2008 2:52 PM
>  To: Velocity Users List
>  Subject: Re: #set to the result of a #parse?
>
>  #set( $processFullInfo = "#parse( 'fullInfoYesNo.vm' )" )
>
>  :)
>
>  On Fri, May 2, 2008 at 1:42 PM, White, Tim <Ti...@qwest.com> wrote:
>  > Hi there -
>  >
>  >   Just curious if there is a way to do somthing like this:
>  >
>  >   #set ($processFullInfo = #parse("fullInfoYesNo.vm"))
>  >
>  >  The idea being that fullInfoYesNo.vm contains YES or NO.
>  >
>  >  I know I can put the whole #set into the #parsed file, but other
>  > processes are using that same file, and need it to be just YES or NO.
>  >
>  >  Thanks,
>  >
>  >  Tim
>  >
>  >
>  >  This communication is the property of Qwest and may contain
>  > confidential or  privileged information. Unauthorized use of this
>  > communication is strictly  prohibited and may be unlawful.  If you
>  > have received this communication  in error, please immediately notify
>  > the sender by reply e-mail and destroy  all copies of the
>  communication and any attachments.
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  For additional commands, e-mail: user-help@velocity.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
>
>
>
>  This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  For additional commands, e-mail: user-help@velocity.apache.org
>

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


RE: #set to the result of a #parse?

Posted by sc...@accenture.com.
Is there any way to #parse a string variable rather than a file?
 
I have a java class that passes a string with in-line references, like so:
 
$refstring = "The beverage I like is ${beverage}."
 
The $beverage variable is populated before this point in the script, but when I return the $refstring variable it is displayed unparsed. How is #parse used to make Velocity re#parse a string variable?
 
Thank you,
 
Scott Grunewald
scott.grunewald@accenture.com
AIM: ScottGrunewald
Office #: 905-804-6942

________________________________

From: White, Tim [mailto:Tim.White@qwest.com]
Sent: Fri 5/2/2008 5:08 PM
To: Velocity Users List
Subject: RE: #set to the result of a #parse?



D'oh!

-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com]
Sent: Friday, May 02, 2008 2:52 PM
To: Velocity Users List
Subject: Re: #set to the result of a #parse?

#set( $processFullInfo = "#parse( 'fullInfoYesNo.vm' )" )

:)

On Fri, May 2, 2008 at 1:42 PM, White, Tim <Ti...@qwest.com> wrote:
> Hi there -
>
>   Just curious if there is a way to do somthing like this:
>
>   #set ($processFullInfo = #parse("fullInfoYesNo.vm"))
>
>  The idea being that fullInfoYesNo.vm contains YES or NO.
>
>  I know I can put the whole #set into the #parsed file, but other 
> processes are using that same file, and need it to be just YES or NO.
>
>  Thanks,
>
>  Tim
>
>
>  This communication is the property of Qwest and may contain
> confidential or  privileged information. Unauthorized use of this
> communication is strictly  prohibited and may be unlawful.  If you
> have received this communication  in error, please immediately notify
> the sender by reply e-mail and destroy  all copies of the
communication and any attachments.
>

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


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






This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.


RE: #set to the result of a #parse?

Posted by "White, Tim" <Ti...@qwest.com>.
D'oh! 

-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com] 
Sent: Friday, May 02, 2008 2:52 PM
To: Velocity Users List
Subject: Re: #set to the result of a #parse?

#set( $processFullInfo = "#parse( 'fullInfoYesNo.vm' )" )

:)

On Fri, May 2, 2008 at 1:42 PM, White, Tim <Ti...@qwest.com> wrote:
> Hi there -
>
>   Just curious if there is a way to do somthing like this:
>
>   #set ($processFullInfo = #parse("fullInfoYesNo.vm"))
>
>  The idea being that fullInfoYesNo.vm contains YES or NO.
>
>  I know I can put the whole #set into the #parsed file, but other  
> processes are using that same file, and need it to be just YES or NO.
>
>  Thanks,
>
>  Tim
>
>
>  This communication is the property of Qwest and may contain 
> confidential or  privileged information. Unauthorized use of this 
> communication is strictly  prohibited and may be unlawful.  If you 
> have received this communication  in error, please immediately notify 
> the sender by reply e-mail and destroy  all copies of the
communication and any attachments.
>

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


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


Re: #set to the result of a #parse?

Posted by Nathan Bubna <nb...@gmail.com>.
#set( $processFullInfo = "#parse( 'fullInfoYesNo.vm' )" )

:)

On Fri, May 2, 2008 at 1:42 PM, White, Tim <Ti...@qwest.com> wrote:
> Hi there -
>
>   Just curious if there is a way to do somthing like this:
>
>   #set ($processFullInfo = #parse("fullInfoYesNo.vm"))
>
>  The idea being that fullInfoYesNo.vm contains YES or NO.
>
>  I know I can put the whole #set into the #parsed file, but other
>  processes are using that same file, and need it to be just YES or NO.
>
>  Thanks,
>
>  Tim
>
>
>  This communication is the property of Qwest and may contain confidential or
>  privileged information. Unauthorized use of this communication is strictly
>  prohibited and may be unlawful.  If you have received this communication
>  in error, please immediately notify the sender by reply e-mail and destroy
>  all copies of the communication and any attachments.
>

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


Re: #set to the result of a #parse?

Posted by Will Glass-Husain <wg...@gmail.com>.
You could write a custom directive to do this.  Just take the one for #parse
and modify it slightly.

WILL

On Fri, May 2, 2008 at 1:42 PM, White, Tim <Ti...@qwest.com> wrote:

> Hi there -
>
>  Just curious if there is a way to do somthing like this:
>
>  #set ($processFullInfo = #parse("fullInfoYesNo.vm"))
>
> The idea being that fullInfoYesNo.vm contains YES or NO.
>
> I know I can put the whole #set into the #parsed file, but other
> processes are using that same file, and need it to be just YES or NO.
>
> Thanks,
>
> Tim
>
>
> This communication is the property of Qwest and may contain confidential
> or
> privileged information. Unauthorized use of this communication is strictly
> prohibited and may be unlawful.  If you have received this communication
> in error, please immediately notify the sender by reply e-mail and destroy
> all copies of the communication and any attachments.
>



-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com