You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Derek Stevenson <de...@retrocode.com> on 2002/08/14 20:02:41 UTC

method calls within method calls

I have the following in one of my layout vm files:

#set ( $ss = $content.getURI("styles/sb.css") )
$page.setStyleSheet("$ss")

To shorten it up a bit, I'd rather do:

$page.setStyleSheet("$content.getURI("styles/sb.css")")

However, I get the following error in the browser:

Horrible Exception: org.apache.velocity.exception.ParseErrorException: 
Encountered "styles" at line 4, column 39. Was expecting one of:
","...
")" ...
<WHITESPACE> ...
[rest of exception ommited]

Is there a way to appropriately escape the quotes/calls so the nested 
getURI call is executed first?

Thanks,
Derek


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


Re: method calls within method calls

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 8/14/02 4:34 PM, "Derek Stevenson" <de...@retrocode.com> wrote:

> Beautiful.  Thanks!
> 
> I'm not sure why, but for some reason I thought parameters had to be in
> quotes.  I guess that only applies to literals.

Just literals.  And there are two kinds of quotes, so to solve the problem
as asked

  $page.setStyleSheet("$content.getURI('styles/sb.css')")

But that's extra work for Velocity, so drop the ""

> 
> Cheers,
> Derek
> 
> At 11:12 AM 8/14/2002, you wrote:
>> On 8/14/02 2:02 PM, "Derek Stevenson" <de...@retrocode.com> wrote:
>> 
>>> I have the following in one of my layout vm files:
>>> 
>>> #set ( $ss = $content.getURI("styles/sb.css") )
>>> $page.setStyleSheet("$ss")
>>> 
>>> To shorten it up a bit, I'd rather do:
>>> 
>>> $page.setStyleSheet("$content.getURI("styles/sb.css")")
>>> 
>>> However, I get the following error in the browser:
>>> 
>>> Horrible Exception: org.apache.velocity.exception.ParseErrorException:
>>> Encountered "styles" at line 4, column 39. Was expecting one of:
>>> ","...
>>> ")" ...
>>> <WHITESPACE> ...
>>> [rest of exception ommited]
>>> 
>>> Is there a way to appropriately escape the quotes/calls so the nested
>>> getURI call is executed first?
>> 
>> 
>> Try
>> 
>>   $page.setStyleSheet( $content.getURI("styles/sb.css"))
>> 
>> Assuming you want to pass the result of getURI() to setStyleSheet()
>> 
>> --
>> Geir Magnusson Jr.
>> Research & Development, Adeptra Inc.
>> geirm@adeptra.com
>> +1-203-247-1713
>> 
>> 
>> 
>> --
>> To unsubscribe, 
>> e-mail:   <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



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


Re: method calls within method calls

Posted by Derek Stevenson <de...@retrocode.com>.
Beautiful.  Thanks!

I'm not sure why, but for some reason I thought parameters had to be in 
quotes.  I guess that only applies to literals.

Cheers,
Derek

At 11:12 AM 8/14/2002, you wrote:
>On 8/14/02 2:02 PM, "Derek Stevenson" <de...@retrocode.com> wrote:
>
> > I have the following in one of my layout vm files:
> >
> > #set ( $ss = $content.getURI("styles/sb.css") )
> > $page.setStyleSheet("$ss")
> >
> > To shorten it up a bit, I'd rather do:
> >
> > $page.setStyleSheet("$content.getURI("styles/sb.css")")
> >
> > However, I get the following error in the browser:
> >
> > Horrible Exception: org.apache.velocity.exception.ParseErrorException:
> > Encountered "styles" at line 4, column 39. Was expecting one of:
> > ","...
> > ")" ...
> > <WHITESPACE> ...
> > [rest of exception ommited]
> >
> > Is there a way to appropriately escape the quotes/calls so the nested
> > getURI call is executed first?
>
>
>Try
>
>   $page.setStyleSheet( $content.getURI("styles/sb.css"))
>
>Assuming you want to pass the result of getURI() to setStyleSheet()
>
>--
>Geir Magnusson Jr.
>Research & Development, Adeptra Inc.
>geirm@adeptra.com
>+1-203-247-1713
>
>
>
>--
>To unsubscribe, 
>e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>



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


Re: method calls within method calls

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 8/14/02 2:02 PM, "Derek Stevenson" <de...@retrocode.com> wrote:

> I have the following in one of my layout vm files:
> 
> #set ( $ss = $content.getURI("styles/sb.css") )
> $page.setStyleSheet("$ss")
> 
> To shorten it up a bit, I'd rather do:
> 
> $page.setStyleSheet("$content.getURI("styles/sb.css")")
> 
> However, I get the following error in the browser:
> 
> Horrible Exception: org.apache.velocity.exception.ParseErrorException:
> Encountered "styles" at line 4, column 39. Was expecting one of:
> ","...
> ")" ...
> <WHITESPACE> ...
> [rest of exception ommited]
> 
> Is there a way to appropriately escape the quotes/calls so the nested
> getURI call is executed first?


Try   

  $page.setStyleSheet( $content.getURI("styles/sb.css"))

Assuming you want to pass the result of getURI() to setStyleSheet()

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



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


RE: method calls within method calls

Posted by Juha Halmu <ju...@pp.inet.fi>.
If you try just single ' , not " in "styles/sb.css"? (I don't know, just
quessing)



 Terveisin,

x--- Juha Halmu ---y
http://portal.halmu.net
ICQ#. 166982747
----------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
--------------------------------------------------------------------------

-----Original Message-----
From: Derek Stevenson [mailto:derek@retrocode.com]
Sent: 14. elokuuta 2002 21:03
To: velocity-user@jakarta.apache.org
Subject: method calls within method calls


I have the following in one of my layout vm files:

#set ( $ss = $content.getURI("styles/sb.css") )
$page.setStyleSheet("$ss")

To shorten it up a bit, I'd rather do:

$page.setStyleSheet("$content.getURI("styles/sb.css")")

However, I get the following error in the browser:

Horrible Exception: org.apache.velocity.exception.ParseErrorException:
Encountered "styles" at line 4, column 39. Was expecting one of:
","...
")" ...
<WHITESPACE> ...
[rest of exception ommited]

Is there a way to appropriately escape the quotes/calls so the nested
getURI call is executed first?

Thanks,
Derek


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





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