I would like to point out something that I am not sure is noted carefully
enough in the documentation. (I am going to have a look at adding what I
say here to the docs.)
There are two ways of specifying the response page in Turbine. The
parameter names "screen" and "template" are used to specify a class or text
file, respectively, that will be used to generate the response. The default
installation of Turbine has moved towards supporting the template parameter
where you are specifying the wm/vm/fm/jsp/etc that is used to generate the
response. So for example using WebMacroSiteLayout as the layout for a
Screen assumes that you have used TemplateSessionValidator or some
variation, along with WebMacroSitePage or some variation, etc. Some of
these classes can be used with the screen parameter, but others are not
relevant to this use, WebMacroSiteLayout being one of them.
Let's say Screen Login is meant to be used with template login.wm. And
Login uses Layout, WebMacroSiteLayout.
If a request comes in with url:
host/servlet/Turbine/template/login.wm
, then the default installation of Turbine is going to look up a Screen and
find Login to be the best match and then it is going to look up a layout
template and find something like layouts/login.wm or layouts/default.wm.
The process is then:
ask Login what its Layout is. Login returns WebMacroSiteLayout.
Turbine executes WebMacroSiteLayout which assumes a layout template has been
specified (probably through the lookup described previously.) It will then
carry out the steps to return the results of the layout template, which will
likely contain the results of the template login.wm as well (if
layouts/default.wm contains a reference $screen_placeholder).
Now on to the screen parameter.
First of all the screen parameter was the original way Turbine used to
specify the response module. It can still have uses, but I think new users
would be better off starting with using the template parameter.
If a request come in with url:
host/servlet/Turbine/screen/Login
, then the default installation of Turbine is going to ask Login what its
Layout is. If Login responds WebMacroSiteLayout (WMSL), there is going to
be an error because WMSL does not know what layout template to use.
This is easy to solve if you have some reason to want to use such an url.
Some reasons for this might be that you are using some other parameter to
specify a template, or the template to use is determined in the code for
Login, or Login does not use a template at all. This is a good way for
several screens to use one template to display their results, for example.
So the rule is if you are going to use the screen parameter you must handle
template associations within the Screen class that is specified. For
example to solve the layoutsnull problem from using WMSL, you can override
the getLayout method in Login to say
public String getLayout(RunData data)
{
data.getTemplateInfo().setLayoutTemplate("default.wm");
return "WebMacroSiteLayout";
}
and if Login is supposed to use login.wm as its template then you would add
a line like:
data.getTemplateInfo().setScreenTemplate("login.wm");
to its build (doBuildTemplate?) method.
Hopefully this clarifies things a bit. One last thing, the default
installation of Turbine does not allow the use of both screen and template
within the url. If both are present it ignores screen and determines the
Screen using its normal lookup mechanism. The reason for this is that a
system may not place security checking code in its templates as the system
designers did not want security to fall into the realm of graphics/page
layout designers. You do not want users to be able to override the
Screen/template relationship. If your application has some need to specify
both, you will need to setup a different parameter that is handled by your
code, or write a different SessionValidator that allows both template and
screen to be specified in the url.
Hope this helps and I will look to see if this can be included in the docs
somewhere.
John McNally
----- Original Message -----
From: John McNally <[EMAIL PROTECTED]>
To: Turbine <[EMAIL PROTECTED]>
Sent: Wednesday, September 20, 2000 9:07 AM
Subject: Re: Login Screen
> Is this with the latest (or within a week) snapshot?
>
> ----- Original Message -----
> From: Christophe Lombart <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 20, 2000 9:54 AM
> Subject: Login Screen
>
>
> > I get an exception when I'm using the following URL :
> > <My Web APP>/servlet/Turbine/screen/Login
> >
> > the turbine log file is :
> >
> > [Wed Sep 20 16:46:37 CEST 2000] -- ERROR --
> > Exception: org.webmacro.NotFoundException: Resource[template,
> layoutsnull]
> > not found: Unable to resolve requested resource
> > Stack Trace follows:
> > org.webmacro.NotFoundException: Resource[template, layoutsnull] not
found:
> > Unable to resolve requested resource
> > at org.webmacro.broker.ResourceEvent.getValue(ResourceEvent.java:314)
> > at org.webmacro.broker.ResourceBroker.getValue(ResourceBroker.java:318)
> > at org.webmacro.WM.getTemplate(WM.java:171)
> > at
> >
>
org.apache.turbine.services.webmacro.TurbineWebMacroService.getTemplate(Turb
> ineWebMacroService.java:250)
> > at
> >
>
org.apache.turbine.services.webmacro.TurbineWebMacroService.handleRequest(Tu
> rbineWebMacroService.java:236)
> > at
> >
>
org.apache.turbine.services.webmacro.TurbineWebMacroService.handleRequest(Tu
> rbineWebMacroService.java:208)
> > at
> >
>
org.apache.turbine.services.webmacro.TurbineWebMacro.handleRequest(TurbineWe
> bMacro.java:107)
> > at
> >
>
org.apache.turbine.modules.layouts.WebMacroSiteLayout.doBuild(WebMacroSiteLa
> yout.java:131)
> > at org.apache.turbine.modules.Layout.build(Layout.java:93)
> > at org.apache.turbine.modules.LayoutLoader.exec(LayoutLoader.java:120)
> > at
> >
org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:171)
> > at org.apache.turbine.modules.Page.build(Page.java:92)
> > at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:119)
> > at org.apache.turbine.Turbine.doGet(Turbine.java:366)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> > at
> >
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:597)
> > at
> >
org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> > at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> > at
> >
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java:156)
> > at
> >
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> )
> > at java.lang.Thread.run(Thread.java:475)
> >
> >
_________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at
http://www.hotmail.com.
> >
> > Share information about yourself, create your own public profile at
> > http://profiles.msn.com.
> >
> >
> >
> > ------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> > Problems?: [EMAIL PROTECTED]
> >
>
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]