You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Melanie Philpot <Me...@anite.com> on 2004/05/19 12:34:34 UTC
link parameters
Can I pass parameters from a link to an action?
How do I go about it?
Basically I want a link to change a layout, so I have set up an action which it goes to.
From the action I want to set the right layout and know where I've linked from so I can set the right screen. (hence the parameter)
Thanks for any help
Melanie
===========================================================
Melanie Philpot
Web Developer
Central Government Division
Anite Public Sector
110 Fleet Road
Fleet
Hampshire
GU51 4BL
tel: 01252 360650
ddi: 01252 360668
fax: 01252 819729
email:mailto:melanie.philpot@anite.com
web: http://www.aniteps.com
===========================================================
Registered Office: Anite Public Sector: 100 Longwater Avenue, GreenPark, Reading, Berkshire, RG2 6GP. VAT No. 732 9280 28
Registered in England No. 4045673
This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please inform the sender and do not print, copy or disclose its contents to any other person nor use it for any purpose other than for what it was intended.
nor use it for any purpose other than for what it was intended.
Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Difference between screen and template.
Posted by Jeffery Painter <pa...@kiasoft.com>.
the difference between screen and template... there really is no physical
template, the TemplateService puts together the final HTML output based on
your Layout, Navigations and then finally your Screen.
You should have a default layout which specifies the position of your
navigations (if you have any) and the $screen_placeholder which is
the location for the contents of your Screen.
1. /template/app/layouts
2. /template/app/navigations
3. /template/app/screens
Layout -> think overall position of elements on screen
You can override layout in the screen by manipulating the
RunData object
data.setLayoutTemplate()
Screen -> the data, content, you wish to display
You can change the screen that is loaded by using setTemplate() in your
screen class
setTemplate( data, "MyScreen.vm" )
setTemplate is really specifying which Screen to use (this could
be a cause of confusion, since it is the screen and not a template we are
specifying)
and NEVER use the "/" slash mark when specifying which pages to load, you
should use the "," constructor
Read these pages again if you need a reference.
http://jakarta.apache.org/turbine/turbine-2.3/howto/velocity-site-howto.html
http://jakarta.apache.org/turbine/turbine-2.3/services/template-service.html
The two golden rules when using Templates with Turbine
* 1) Many examples and docs from older Turbine code show template
paths with a slashes.
Repeat after me: TEMPLATE NAMES NEVER CONTAIN SLASHES!
Template names are separated by "," (the comma).
* 2) Many examples and docs from older Turbine code show templates
that start with "/". This is not only a violation of the rule above but
actively breaks things like loading templates from a jar with the velocity
jar loader.
Repeat after me: TEMPLATE NAMES ARE NOT PATHS. THEY'RE NOT ABSOLUTE
AND HAVE NO LEADING /.
On Wed, 19 May 2004, Anthony Smith wrote:
> Could somepne explain to to me the difference or one reason to use on over
> the other?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Difference between screen and template.
Posted by Anthony Smith <an...@fedex.com>.
Could somepne explain to to me the difference or one reason to use on over
the other?
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: link parameters
Posted by Peter Courcoux <pe...@courcoux.biz>.
Melanie,
If you want a particular screen to always be displayed with a different
layout from the default (which is usually
templates/app/layouts/Default.vm) then you can use a screen class and
call
data.setLayoutTemplate("NewLayout.vm");
in the doBuildTemplate(RunData data) method.
Your class should probably extend VelocityScreen or VelocitySecureScreen
and must be placed in the modules path which turbine will look through
when it searches for the screen classes. See the modules.packages entry
in TurbineResources.properties. The screen class must have the same name
as the screen, ie. MyScreen.vm would have a corresponding MyScreen.java
class.
I hope this helps.
Peter
On Wed, 2004-05-19 at 11:34, Melanie Philpot wrote:
> Can I pass parameters from a link to an action?
> How do I go about it?
>
> Basically I want a link to change a layout, so I have set up an action which it goes to.
> >From the action I want to set the right layout and know where I've linked from so I can set the right screen. (hence the parameter)
>
> Thanks for any help
>
> Melanie
>
> ===========================================================
> Melanie Philpot
> Web Developer
> Central Government Division
> Anite Public Sector
> 110 Fleet Road
> Fleet
> Hampshire
> GU51 4BL
>
> tel: 01252 360650
> ddi: 01252 360668
> fax: 01252 819729
>
> email:mailto:melanie.philpot@anite.com
> web: http://www.aniteps.com
> ===========================================================
> Registered Office: Anite Public Sector: 100 Longwater Avenue, GreenPark, Reading, Berkshire, RG2 6GP. VAT No. 732 9280 28
> Registered in England No. 4045673
>
> This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please inform the sender and do not print, copy or disclose its contents to any other person nor use it for any purpose other than for what it was intended.
> nor use it for any purpose other than for what it was intended.
>
>
>
> Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.
>
> ---------------------------------------------------------------------
> 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
Re: link parameters
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Daniel <da...@yorku.ca> writes:
><a href="$link.setPage('MyPage.vm').setAction('MyAction').addPathInfo('foo', 'bar')">My Link</a>
>That would execute the doPerform(..) method.
>If you want a particular method in the action to be invoked, then add:
> .addPathInfo('eventsubmit_doMethod', '')
> - where "doMethod" is the name of the name you'd like to invoke in
> your action class
You might want to use
$link.setActionEvent('MyAction', 'MyEvent')
which hides the gory details of eventSubmit_do and the addPathInfo for you.
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire
Linux, Java, perl, Solaris -- Consulting, Training, Development
"Fighting for one's political stand is an honourable action, but re-
fusing to acknowledge that there might be weaknesses in one's
position - in order to identify them so that they can be remedied -
is a large enough problem with the Open Source movement that it
deserves to be on this list of the top five problems."
-- Michelle Levesque, "Fundamental Issues with
Open Source Software Development"
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: link parameters
Posted by Daniel <da...@yorku.ca>.
Hi,
Something like this:
<a href="$link.setPage('MyPage.vm').setAction('MyAction').addPathInfo('foo', 'bar')">My Link</a>
That would execute the doPerform(..) method.
If you want a particular method in the action to be invoked, then add:
.addPathInfo('eventsubmit_doMethod', '')
- where "doMethod" is the name of the name you'd like to invoke in
your action class
Regards,
Daniel
On Wed, 19 May 2004, Melanie Philpot wrote:
> Can I pass parameters from a link to an action?
> How do I go about it?
>
> Basically I want a link to change a layout, so I have set up an action which it goes to.
> >From the action I want to set the right layout and know where I've linked from so I can set the right screen. (hence the parameter)
>
> Thanks for any help
>
> Melanie
>
> ===========================================================
> Melanie Philpot
> Web Developer
> Central Government Division
> Anite Public Sector
> 110 Fleet Road
> Fleet
> Hampshire
> GU51 4BL
>
> tel: 01252 360650
> ddi: 01252 360668
> fax: 01252 819729
>
> email:mailto:melanie.philpot@anite.com
> web: http://www.aniteps.com
> ===========================================================
> Registered Office: Anite Public Sector: 100 Longwater Avenue, GreenPark, Reading, Berkshire, RG2 6GP. VAT No. 732 9280 28
> Registered in England No. 4045673
>
> This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please inform the sender and do not print, copy or disclose its contents to any other person nor use it for any purpose other than for what it was intended.
> nor use it for any purpose other than for what it was intended.
>
>
>
> Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.
>
> ---------------------------------------------------------------------
> 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
RE: link parameters
Posted by David Demner <tu...@demner.com>.
Hi Melanie,
I think you're asking for this (which would go in your template):
$link.setAction("YourAction").setPage("GoHere.vm").addQueryData("parm",
"value")
This will call YourAction. If YourAction doesn't do a setTemplate or
redirect or something, then GoHere.vm will be shown after the action is
complete. You can get "value" in your action by using
data.getParameters().getString("parm")
That being said, however... How do you want to change the layout? Are you
just applying a skin? If so, have a look at the UIManager class. This
might be what you're looking for and not require a bunch of templates to
change the look of your application.
Good luck,
David
-----Original Message-----
From: Melanie Philpot [mailto:Melanie.Philpot@anite.com]
Sent: Wednesday May 19, 2004 3:35 AM
To: Turbine User (E-mail)
Subject: link parameters
Can I pass parameters from a link to an action?
How do I go about it?
Basically I want a link to change a layout, so I have set up an action which
it goes to.
>From the action I want to set the right layout and know where I've linked
from so I can set the right screen. (hence the parameter)
Thanks for any help
Melanie
===========================================================
Melanie Philpot
Web Developer
Central Government Division
Anite Public Sector
110 Fleet Road
Fleet
Hampshire
GU51 4BL
tel: 01252 360650
ddi: 01252 360668
fax: 01252 819729
email:mailto:melanie.philpot@anite.com
web: http://www.aniteps.com
===========================================================
Registered Office: Anite Public Sector: 100 Longwater Avenue, GreenPark,
Reading, Berkshire, RG2 6GP. VAT No. 732 9280 28
Registered in England No. 4045673
This email and any files transmitted with it are confidential and are
intended solely for the use of the individual or entity to whom they are
addressed. If you have received this email in error please inform the sender
and do not print, copy or disclose its contents to any other person nor use
it for any purpose other than for what it was intended.
nor use it for any purpose other than for what it was intended.
Scanned for viruses by MessageLabs. The integrity and security of this
message cannot be guaranteed. This email is intended for the named recipient
only, and may contain confidential information and proprietary material. Any
unauthorised use or disclosure is prohibited.
---------------------------------------------------------------------
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