You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Kenneth Andreasen <ke...@andreasen.info> on 2003/01/06 11:37:56 UTC

Test if template exists

In the system I'm designing I need to display a special screen, but only if it 
exists. Witch is not allways the case. How do I test if a template exists 
before doing "data.setScreenTemplate( sSpecialTemplate );"?

Or is there an other way to avoid setScreenTemplate displaying the Error 
screen if the specified template is missing?

Thanks,
Kenneth




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


Smart Login..? -- revisited.

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
I found this script in the Archive. Just a couple of questions on the
script as given below.

I have created a MySecureScreen.java file (extends SecrureScreen.java) and
put the suggested code in it. I then change my Index.java to extended
MySecureScreen.java instead of SecureScreen.java.

I run the Login.vm using the added lines:

> #if($oldurl)
> action="$oldurl.setAction("LoginUser")"
> #else
> action="$link.setPage("Index.vm").setAction("LoginUser")"
> #end

But I did not get the intended result, i.e. redirect to the right page.

where have I done wrong?

thankx for any in put.
michael





Leon Messerschmidt wrote:

> Hi Matt,
>
> This works well for me.  I have a secure screen and in isAutorized() I do
> something like this:
>
> if (user != null && user.hasLoggedIn())
> {
> doBuildSecureTemplate (data,context);
> }
> else
> {
> try
> {
> data.setMessage("invalid_login");
> DynamicURI lastUrl = new DynamicURI (data);
> lastUrl.addPathInfo (data.getParameters());
> lastUrl.addPathInfo
> ("template",data.getTemplateInfo().getScreenTemplate());
> context.put("oldurl",lastUrl);
> data.getTemplateInfo().setScreenTemplate("Login.vm");
> }
> catch (Exception e)
> {
> Log.error (e);
> }
>
> return;
>
> }
>
> In my login screen I simply use something like this:
>
> #if($oldurl)
> action="$oldurl.setAction("LoginUser")"
> #else
> action="$link.setPage("Index.vm").setAction("LoginUser")"
> #end
>
> This works pretty cool because any screen that requires a login will go to
> the login screen if your are not logged in and return to the right screen
> when you have successfully logged in without any extra logic.
>
> Hope it helps.
>
> ~ Leon
>
> ----- Original Message






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


Re: Test if template exists

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
On Mon, 2003-01-06 at 08:37, Kenneth Andreasen wrote:
> 
> In the system I'm designing I need to display a special screen, but only if it 
> exists. Witch is not allways the case. How do I test if a template exists 
> before doing "data.setScreenTemplate( sSpecialTemplate );"?

see TurbineVelocity.templateExists(String templateName)

Be sure to prepend the template name with the "template type", e.g.

<java>
if(TurbineVelocity.templateExists("screens/" + screenToSearchFor))
</java>

> 
> Or is there an other way to avoid setScreenTemplate displaying the Error 
> screen if the specified template is missing?
> 
> Thanks,
> Kenneth
-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://jakarta.apache.org/ojb


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