You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by daniel robinson <dr...@dnai.com> on 2002/07/05 05:11:32 UTC

$serverName problem

Ok,

I'm trying to get a test going using a Tool.  I put the string:

$session.Xsltool.transform("\xsl\index2.xml","index2.xsl")

And when I run the page all I get is this string.  The same thing 
happens in the Sample app with the Servelet example and $serverName.  I 
have looked at the archives and this question has been asked a bunch of 
times and never answered as far as I can tell.

Dan


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


Re: $serverName problem

Posted by Dan Robinson <dr...@dnai.com>.
Jeff,

Thanks for responding.   Sorry it took so long to get back,  I've been 
out of town (and my computer crashed and ....) Anyway your code snippet 
works just fine!  

After I posted my last message I looked more closely at the classpaths 
etc.  But didn't see anything.

as for:

I would guess that you are either changing Velocity templates

I may be.  That is why I'm focussing on the $serverName problem - since 
this is part of the TDK example and code that didn't work when I did the 
install.  I've altered it slightly now - so that it now reads:

import org.apache.turbine.util.RunData;
import org.apache.turbine.services.servlet.TurbineServlet;
import org.apache.velocity.context.Context;

/**
 * Grab all the records in a table using a Peer, and
 * place the Vector of data objects in the context
 * where they can be displayed by a #foreach loop.
 *
 * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
 */
public class ServletInfo extends SecureScreen
{
    /**
     * Place all the data object in the context
     * for use in the template.
     */
    public void doBuildTemplate( RunData data, Context context )
    {
        context.put("fooValue", "a Fool");                            
                        <-------------------------  ADDED THIS
        context.put("serverName", TurbineServlet.getServerName());       
                 
    }
}

This was just to see if the problem was with the TurbineServlet 
code/path etc.

BTW the output using the above is:

Servlet Info: $serverName
Foo Info: $fooValue

Perhaps it would be useful to go through the steps of putting up a 
trivial page (like with my foo example above) in a step-by-step manner 
to see if it is something silly.

Thanks,

Dan

Jeff Linwood wrote:

>Hmm,
>
>I would guess that you are either changing Velocity templates that aren't
>going through Turbine, or that your tool isn't specified correctly.
>
>Try this little snippet of Velocity code:
>
>#set( $test = "yes" )
>Is Velocity Working? $test
>
>That will at least tell us whether or not Velocity works.
>
>----- Original Message -----
>From: "daniel robinson" <dr...@dnai.com>
>To: "Turbine Users List" <tu...@jakarta.apache.org>
>Sent: Friday, July 05, 2002 12:38 AM
>Subject: Re: $serverName problem
>
>
>>Jeff,
>>
>>Thanks for responding.  No go.
>>
>>$Xsltool.transform("\xsl\index2.xml","index2.xsl")
>>
>>just gives comes back as a literal in the generated page.
>>
>>To tell you the truth I'd feel alot better if template/ServletInfo.vm
>>from the example wasn't returning
>>
>>Servlet Info: $serverName
>>
>>This seems like pretty much the same problem.
>>
>>Thanks,
>>
>>Dan
>>
>>Jeff Linwood wrote:
>>
>>>Hi,
>>>
>>>Assuming that Xsltool is specified in your TurbineResources.properties as
>>>
>a
>
>>>tool, use $Xsltool.transform("\xsl\index2.xml","index2.xsl")
>>>
>>>Velocity doesn't hide references that don't exist, unless you use $!
>>>
>instead
>
>>>of $ to mark Velocity statements.
>>>
>>>Let us know if this works,
>>>
>>>Jeff
>>>----- Original Message -----
>>>From: "daniel robinson" <dr...@dnai.com>
>>>To: <tu...@jakarta.apache.org>
>>>Sent: Thursday, July 04, 2002 10:11 PM
>>>Subject: $serverName problem
>>>
>>>
>>>>Ok,
>>>>
>>>>I'm trying to get a test going using a Tool.  I put the string:
>>>>
>>>>$session.Xsltool.transform("\xsl\index2.xml","index2.xsl")
>>>>
>>>>And when I run the page all I get is this string.  The same thing
>>>>happens in the Sample app with the Servelet example and $serverName.  I
>>>>have looked at the archives and this question has been asked a bunch of
>>>>times and never answered as far as I can tell.
>>>>
>>>>Dan
>>>>
>>>>
>>>>--
>>>>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>
>
>>>
>>>
>>
>
>
>--
>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: $serverName problem

Posted by Jeff Linwood <je...@greenninja.com>.
Hmm,

I would guess that you are either changing Velocity templates that aren't
going through Turbine, or that your tool isn't specified correctly.

Try this little snippet of Velocity code:

#set( $test = "yes" )
Is Velocity Working? $test

That will at least tell us whether or not Velocity works.

----- Original Message -----
From: "daniel robinson" <dr...@dnai.com>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Friday, July 05, 2002 12:38 AM
Subject: Re: $serverName problem


> Jeff,
>
> Thanks for responding.  No go.
>
> $Xsltool.transform("\xsl\index2.xml","index2.xsl")
>
> just gives comes back as a literal in the generated page.
>
> To tell you the truth I'd feel alot better if template/ServletInfo.vm
> from the example wasn't returning
>
> Servlet Info: $serverName
>
> This seems like pretty much the same problem.
>
> Thanks,
>
> Dan
>
> Jeff Linwood wrote:
>
> >Hi,
> >
> >Assuming that Xsltool is specified in your TurbineResources.properties as
a
> >tool, use $Xsltool.transform("\xsl\index2.xml","index2.xsl")
> >
> >Velocity doesn't hide references that don't exist, unless you use $!
instead
> >of $ to mark Velocity statements.
> >
> >Let us know if this works,
> >
> >Jeff
> >----- Original Message -----
> >From: "daniel robinson" <dr...@dnai.com>
> >To: <tu...@jakarta.apache.org>
> >Sent: Thursday, July 04, 2002 10:11 PM
> >Subject: $serverName problem
> >
> >
> >>Ok,
> >>
> >>I'm trying to get a test going using a Tool.  I put the string:
> >>
> >>$session.Xsltool.transform("\xsl\index2.xml","index2.xsl")
> >>
> >>And when I run the page all I get is this string.  The same thing
> >>happens in the Sample app with the Servelet example and $serverName.  I
> >>have looked at the archives and this question has been asked a bunch of
> >>times and never answered as far as I can tell.
> >>
> >>Dan
> >>
> >>
> >>--
> >>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>
> >
> >
> >
>
>


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


Re: $serverName problem

Posted by daniel robinson <dr...@dnai.com>.
Jeff,

Thanks for responding.  No go.

$Xsltool.transform("\xsl\index2.xml","index2.xsl")

just gives comes back as a literal in the generated page.  

To tell you the truth I'd feel alot better if template/ServletInfo.vm 
from the example wasn't returning

Servlet Info: $serverName

This seems like pretty much the same problem.

Thanks,

Dan

Jeff Linwood wrote:

>Hi,
>
>Assuming that Xsltool is specified in your TurbineResources.properties as a
>tool, use $Xsltool.transform("\xsl\index2.xml","index2.xsl")
>
>Velocity doesn't hide references that don't exist, unless you use $! instead
>of $ to mark Velocity statements.
>
>Let us know if this works,
>
>Jeff
>----- Original Message -----
>From: "daniel robinson" <dr...@dnai.com>
>To: <tu...@jakarta.apache.org>
>Sent: Thursday, July 04, 2002 10:11 PM
>Subject: $serverName problem
>
>
>>Ok,
>>
>>I'm trying to get a test going using a Tool.  I put the string:
>>
>>$session.Xsltool.transform("\xsl\index2.xml","index2.xsl")
>>
>>And when I run the page all I get is this string.  The same thing
>>happens in the Sample app with the Servelet example and $serverName.  I
>>have looked at the archives and this question has been asked a bunch of
>>times and never answered as far as I can tell.
>>
>>Dan
>>
>>
>>--
>>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: $serverName problem

Posted by Jeff Linwood <je...@greenninja.com>.
Hi,

Assuming that Xsltool is specified in your TurbineResources.properties as a
tool, use $Xsltool.transform("\xsl\index2.xml","index2.xsl")

Velocity doesn't hide references that don't exist, unless you use $! instead
of $ to mark Velocity statements.

Let us know if this works,

Jeff
----- Original Message -----
From: "daniel robinson" <dr...@dnai.com>
To: <tu...@jakarta.apache.org>
Sent: Thursday, July 04, 2002 10:11 PM
Subject: $serverName problem


> Ok,
>
> I'm trying to get a test going using a Tool.  I put the string:
>
> $session.Xsltool.transform("\xsl\index2.xml","index2.xsl")
>
> And when I run the page all I get is this string.  The same thing
> happens in the Sample app with the Servelet example and $serverName.  I
> have looked at the archives and this question has been asked a bunch of
> times and never answered as far as I can tell.
>
> Dan
>
>
> --
> 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>