You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Foth, Oliver" <Ol...@gedas.de> on 2001/03/15 14:53:23 UTC

javascript and turbine

Hi,
we're trying to build up a web-application with turbine/velocity and wanted
(and still want) to include external javascript and css files in our
website. We've added the following source-code to the
"TemplatePageAttributes" java-file:

    public TemplatePageAttributes setScript(String url)
    {
        data.getPage().getHead().addElement(new Script()
        .setLanguage("JavaScript").setType("text/javascript").setSrc(url));
        return this;
    }

The link to the stylesheet as well as the link to the *.js appear correctly
in the <head> of the html/vm document. But it looks like turbine is trying
to load a class instead of just including the two files to our document.
When trying to run the index.vm, we get the following error-message:

java.lang.ClassNotFoundException: navi.js
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
.java, Compiled Code)
	at java.lang.Exception.<init>(Exception.java, Compiled Code)
	at
java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java,
Compiled Code)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
.java, Compiled Code)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
.java, Compiled Code)
	at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:722)
	at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:544)
	at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
:337)
	at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:144)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:215)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:251)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:196)
	at
org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:464)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java,
Compiled Code)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161
)
	at
org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java,
Compiled Code)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:159)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java,
Compiled Code)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java,
Compiled Code)
	at java.lang.Thread.run(Thread.java:479)

Any ideas how we can solve this problem?

Thanks in advance,

Oliver Foth

------------------------------------------------
gedas deutschland GmbH
Team IDIS
Johann-Siegmund-Schuckert Str. 2a
D-34225 Baunatal
Telefon/phone	+49-561-49995-47
Telefax/telefax	+49-561-49995-52
mailto:oliver.foth@gedas.de
http://www.gedas.net
------------------------------------------------


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


Re: TurbineConstants

Posted by Daniel Rall <dl...@collab.net>.
Jason van Zyl <jv...@apache.org> writes:

> Hi,
> 
> I was just looking at adding multiple template paths to the Template service
> and the Velocity service and I noticed the use of free text properties and
> I wanted to replace them with constants.
> 
> Right a lot of the constants are listed in TurbineResources, but would it
> make more sense to have a TurbineConstants.java along side the Turbine.java
> file and use that throughout the code. So all we have to do then is keep
> the TurbineConstants updated with the TR.props and everything will
> be cool. Right now the constants are kind of buried in one of the Turbine
> services which might be the reason the constants aren't used that
> much throughout the code base. Just a thought.

A most hearty +1.
-- 

Daniel Rall <dl...@collab.net>

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


TurbineConstants

Posted by Jason van Zyl <jv...@apache.org>.
Hi,

I was just looking at adding multiple template paths to the Template service
and the Velocity service and I noticed the use of free text properties and
I wanted to replace them with constants.

Right a lot of the constants are listed in TurbineResources, but would it
make more sense to have a TurbineConstants.java along side the Turbine.java
file and use that throughout the code. So all we have to do then is keep
the TurbineConstants updated with the TR.props and everything will
be cool. Right now the constants are kind of buried in one of the Turbine
services which might be the reason the constants aren't used that
much throughout the code base. Just a thought.

jvz.


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


Re: javascript and turbine

Posted by Leon Messerschmidt <le...@opticode.co.za>.
Hi Oliver,

Make sure that your .js file is downloaded as a static file (like images)
and not a servlet.

You can also take a look at VelocityOnlyLayout to make things a bit easier
for adding stuff to <head>

~ Leon

----- Original Message -----
From: "Foth, Oliver" <Ol...@gedas.de>
To: <tu...@jakarta.apache.org>
Sent: Thursday, March 15, 2001 3:53 PM
Subject: javascript and turbine


> Hi,
> we're trying to build up a web-application with turbine/velocity and
wanted
> (and still want) to include external javascript and css files in our
> website. We've added the following source-code to the
> "TemplatePageAttributes" java-file:
>
>     public TemplatePageAttributes setScript(String url)
>     {
>         data.getPage().getHead().addElement(new Script()
>
.setLanguage("JavaScript").setType("text/javascript").setSrc(url));
>         return this;
>     }
>
> The link to the stylesheet as well as the link to the *.js appear
correctly
> in the <head> of the html/vm document. But it looks like turbine is trying
> to load a class instead of just including the two files to our document.
> When trying to run the index.vm, we get the following error-message:
>
> java.lang.ClassNotFoundException: navi.js
> at
>
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
> .java, Compiled Code)
> at java.lang.Exception.<init>(Exception.java, Compiled Code)
> at
> java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java,
> Compiled Code)
> at
>
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
> .java, Compiled Code)
> at
>
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
> .java, Compiled Code)
> at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:722)
> at
>
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:544)
> at
>
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
> :337)
> at
> org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:144)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:215)
> at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:251)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:196)
> at
> org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
> at
>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
> .java:464)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java,
> Compiled Code)
> at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161
> )
> at
> org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java,
> Compiled Code)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :159)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> at
>
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java,
> Compiled Code)
> at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java,
> Compiled Code)
> at java.lang.Thread.run(Thread.java:479)
>
> Any ideas how we can solve this problem?
>
> Thanks in advance,
>
> Oliver Foth
>
> ------------------------------------------------
> gedas deutschland GmbH
> Team IDIS
> Johann-Siegmund-Schuckert Str. 2a
> D-34225 Baunatal
> Telefon/phone +49-561-49995-47
> Telefax/telefax +49-561-49995-52
> mailto:oliver.foth@gedas.de
> http://www.gedas.net
> ------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>


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