You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Scott Anderson <sa...@ttm.com> on 2001/03/26 17:54:54 UTC

Having problems with finding screens.

Hi all,

Here's the issue:

I have a MyAppScreen.java that checks for an authorized user.  If it
can't find one, it does the following:

            data.getTemplateInfo().setScreenTemplate("Login");
            data.setScreen("Login");


I have a src/java/.../modules/screens/Login.java that overrides
doBuild() and returns a ConcreteElement. This, however, is not being
found:

Mon Mar 26 10:47:00 EST 2001   [info] Attempting to find /screens/Login
with org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:47:00 EST 2001  [error] FileResourceLoader Error: cannot
find resource /usr/local/src/portal/src/ui/templates/screens/Login
Mon Mar 26 10:47:00 EST 2001   [info] Attempting to find /screens/Login
with org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:47:00 EST 2001  [error] FileResourceLoader Error: cannot
find resource /usr/local/dev/tdk/bin/./screens/Login
Mon Mar 26 10:47:00 EST 2001  [error] java.lang.Exception: Can't find
/screens/Login!
Mon Mar 26 10:47:00 EST 2001  [error] Template.merge() failure. The
document is null, most likely due to parsing error.

So, I added a templates/screens/Login.vm, but this is not being found
either.

If I remove the setScreenTemplate() line, I get the following:

Mon Mar 26 10:53:24 EST 2001   [info] Attempting to find
/screens//Index.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:53:24 EST 2001   [warn]
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = /screens//Index.vm [line 29,column 10] :
$userfoo.getUserName() is not a valid reference.
Mon Mar 26 10:53:25 EST 2001   [info] Attempting to find
layouts/Default.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:53:25 EST 2001   [info] Attempting to find
navigations//DefaultTop.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:53:25 EST 2001   [info] Attempting to find
navigations//DefaultBottom.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader

and Index.vm is loaded (this is the default newapp configuration, other
than I have created MyAppScreen.java and descended Default.java from it.

Help! :-)

Regards,

-scott

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


RE: Having problems with finding screens.

Posted by Keng Wong <ke...@verizon.net>.
Apparently your problem is not in any of the build scripts or
classpath stuff. Do not change those.

I faced the same problem before and this is how it should be coded:

In your MyAppScreen.java:

data.getTemplateInfo().setScreenTemplate("/Login.vm");

You do not need data.setScreen().

Of course the better approach will be

data.getTemplateInfo().setScreenTemplate(
	TurbineResources.getString("template.login"));

And in your TurbineResources.properties:

template.login=/Login.vm

This is supposing you have Login.vm in .../templates/screens/.

It worked for me and should work for you out of the box (i mean TDK). Good
Luck!

PS: If all else fails, reinstall the TDK and create the app from scratch.
Start with a simple Default.java and it should work.

-keng


-----Original Message-----
From: anderson [mailto:anderson]On Behalf Of Scott Anderson
Sent: Monday, March 26, 2001 7:55 AM
To: turbine
Subject: Having problems with finding screens.


Hi all,

Here's the issue:

I have a MyAppScreen.java that checks for an authorized user.  If it
can't find one, it does the following:

            data.getTemplateInfo().setScreenTemplate("Login");
            data.setScreen("Login");


I have a src/java/.../modules/screens/Login.java that overrides
doBuild() and returns a ConcreteElement. This, however, is not being
found:

Mon Mar 26 10:47:00 EST 2001   [info] Attempting to find /screens/Login
with org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:47:00 EST 2001  [error] FileResourceLoader Error: cannot
find resource /usr/local/src/portal/src/ui/templates/screens/Login
Mon Mar 26 10:47:00 EST 2001   [info] Attempting to find /screens/Login
with org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:47:00 EST 2001  [error] FileResourceLoader Error: cannot
find resource /usr/local/dev/tdk/bin/./screens/Login
Mon Mar 26 10:47:00 EST 2001  [error] java.lang.Exception: Can't find
/screens/Login!
Mon Mar 26 10:47:00 EST 2001  [error] Template.merge() failure. The
document is null, most likely due to parsing error.

So, I added a templates/screens/Login.vm, but this is not being found
either.

If I remove the setScreenTemplate() line, I get the following:

Mon Mar 26 10:53:24 EST 2001   [info] Attempting to find
/screens//Index.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:53:24 EST 2001   [warn]
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = /screens//Index.vm [line 29,column 10] :
$userfoo.getUserName() is not a valid reference.
Mon Mar 26 10:53:25 EST 2001   [info] Attempting to find
layouts/Default.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:53:25 EST 2001   [info] Attempting to find
navigations//DefaultTop.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Mon Mar 26 10:53:25 EST 2001   [info] Attempting to find
navigations//DefaultBottom.vm with
org.apache.velocity.runtime.resource.loader.FileResourceLoader

and Index.vm is loaded (this is the default newapp configuration, other
than I have created MyAppScreen.java and descended Default.java from it.

Help! :-)

Regards,

-scott

---------------------------------------------------------------------
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