You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alan Nisbet <al...@ecebs.com> on 2008/04/25 17:15:01 UTC
Passing parameters to ftl template with s:param
Hi,
First time poster and relative struts newbie,
I'm trying to create an ftl template that positions two
s:datetimepicker(s) side by side to capture date and time.
I use the s:component tag and define my template shown below. It is
working relatively well however I'm unable to retrieve any parameters
via the ${parameters.myParam} notation (only defaults are being set). In
my JSP I'm using s:param tag to define the parameters.
Can anyone help me?
************************************************************
dateandtime.ftl
---------------
<#include
"/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
<@s.dateTimePicker
theme="simple"
name="${parameters.dateName?default('fromDate')}"
type="date"
displayFormat="${parameters.dateFormat?default('dd/MM/yyyy')}" />
<@s.dateTimePicker
theme="simple"
name="${parameters.timeName?default('startTime')}"
type="time"
displayFormat="${parameters.dateFormat?default('HH:mm')}" />
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" />
******************************************************
Best Regards,
Alan.
--
------------------------------------------------------------------
Alan Nisbet Phone: +44(0)1355 272911
Software Engineer Fax: +44(0)1355 272993
Ecebs Limited
The Toros Building,
Rankin Avenue
Scottish Enterprise Technology Park,
East Kilbride
G75 0QF Email: alan.nibset@ecebs.com
United Kingdom Internet: http://www.Ecebs.com
This email is only for the use of the addressee. It may contain
information which is legally privileged, confidential and exempt
from disclosure. If you are not the intended recipient you are
hereby notified that any dissemination, distribution, or copying
of this communication and its attachments is strictly prohibited.
------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Passing parameters to ftl template with s:param
Posted by Peter Wages <pm...@gmail.com>.
If you want to use the value parameter, you must enclose the value
with single quotation marks in addition to double quotation marks. ,
if your value is a string
" ' value ' "
The value parameter is assuming you are passing an object. This is
associated with OGNL
What worked for you Alan, putting the value in the body of the tag,
is good . This is the simplest way. Here Struts is assuming you are
working with a string.
I spent a day with this problem. This is noted the param docs
On 4/28/08, Alan Nisbet <al...@ecebs.com> wrote:
> Hi,
>
> In case anyone is interested
>
> s:param tag only works(for me) when value is defined in body of tag and not
> in value attribute
>
> <s:param name="date" value="fromDate" /> doesn't work
> <s:param name="date">fromDate</s:param> does work
>
>
> Alan Nisbet wrote:
> > Hi,
> >
> > First time poster and relative struts newbie,
> >
> > I'm trying to create an ftl template that positions two
> s:datetimepicker(s) side by side to capture date and time.
> >
> > I use the s:component tag and define my template shown below. It is
> working relatively well however I'm unable to retrieve any parameters via
> the ${parameters.myParam} notation (only defaults are being set). In my JSP
> I'm using s:param tag to define the parameters.
> >
> > Can anyone help me?
> >
> >
> ************************************************************
> > dateandtime.ftl
> > ---------------
> >
> > <#include
> "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl"
> />
> >
> > <@s.dateTimePicker
> > theme="simple"
> > name="${parameters.dateName?default('fromDate')}"
> > type="date"
> >
> displayFormat="${parameters.dateFormat?default('dd/MM/yyyy')}"
> />
> >
> >
> >
> >
> >
> > <@s.dateTimePicker
> > theme="simple"
> > name="${parameters.timeName?default('startTime')}"
> > type="time"
> >
> displayFormat="${parameters.dateFormat?default('HH:mm')}"
> />
> >
> > <#include
> "/${parameters.templateDir}/xhtml/controlfooter.ftl" />
> > ******************************************************
> >
> > Best Regards,
> >
> > Alan.
> >
> >
>
> Best Regards,
>
> Alan.
>
> --
> ------------------------------------------------------------------
> Alan Nisbet Phone: +44(0)1355 272911
> Software Engineer Fax: +44(0)1355 272993
> Ecebs Limited
> The Toros Building,
> Rankin Avenue
> Scottish Enterprise Technology Park,
> East Kilbride
> G75 0QF Email: alan.nibset@ecebs.com
> United Kingdom Internet: http://www.Ecebs.com
>
> This email is only for the use of the addressee. It may contain
> information which is legally privileged, confidential and exempt
> from disclosure. If you are not the intended recipient you are
> hereby notified that any dissemination, distribution, or copying
> of this communication and its attachments is strictly prohibited.
> ------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Passing parameters to ftl template with s:param
Posted by Alan Nisbet <al...@ecebs.com>.
Hi,
In case anyone is interested
s:param tag only works(for me) when value is defined in body of tag and
not in value attribute
<s:param name="date" value="fromDate" /> doesn't work
<s:param name="date">fromDate</s:param> does work
Alan Nisbet wrote:
> Hi,
>
> First time poster and relative struts newbie,
>
> I'm trying to create an ftl template that positions two
> s:datetimepicker(s) side by side to capture date and time.
>
> I use the s:component tag and define my template shown below. It is
> working relatively well however I'm unable to retrieve any parameters
> via the ${parameters.myParam} notation (only defaults are being set).
> In my JSP I'm using s:param tag to define the parameters.
>
> Can anyone help me?
>
> ************************************************************
> dateandtime.ftl
> ---------------
>
> <#include
> "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
>
> <@s.dateTimePicker
> theme="simple"
> name="${parameters.dateName?default('fromDate')}"
> type="date"
> displayFormat="${parameters.dateFormat?default('dd/MM/yyyy')}" />
>
>
>
>
>
> <@s.dateTimePicker
> theme="simple"
> name="${parameters.timeName?default('startTime')}"
> type="time"
> displayFormat="${parameters.dateFormat?default('HH:mm')}" />
>
> <#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" />
> ******************************************************
>
> Best Regards,
>
> Alan.
>
Best Regards,
Alan.
--
------------------------------------------------------------------
Alan Nisbet Phone: +44(0)1355 272911
Software Engineer Fax: +44(0)1355 272993
Ecebs Limited
The Toros Building,
Rankin Avenue
Scottish Enterprise Technology Park,
East Kilbride
G75 0QF Email: alan.nibset@ecebs.com
United Kingdom Internet: http://www.Ecebs.com
This email is only for the use of the addressee. It may contain
information which is legally privileged, confidential and exempt
from disclosure. If you are not the intended recipient you are
hereby notified that any dissemination, distribution, or copying
of this communication and its attachments is strictly prohibited.
------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org