struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: Adding additional parameters to struts 2 tags and accessing them in the ftl files
Date Thu, 30 Aug 2007 06:55:47 GMT
Excellent!  Interesting history.  Hopefully the resistance to dynamic 
attributes is now well overtaken by events.

James Holmes wrote:
> Take a look at this JIRA issue:
>
> https://issues.apache.org/struts/browse/WW-2132
>
> I'm working on adding JSP 2.0's dynamic attributes functionality to Struts
> 2.1.
>
> James
>
>
> -----Original Message-----
> From: Jeromy Evans [mailto:jeromy.evans@blueskyminds.com.au] 
> Sent: Thursday, August 30, 2007 1:34 AM
> To: Struts Users Mailing List
> Subject: Re: Adding additional parameters to struts 2 tags and accessing
> them in the ftl files
>
> It's not as easy as that. Each struts2 tag is:
>   - defined in the struts-tags.tld file, including all available 
> attributes;  and
>   - backed by one or more classes that implements the tag's functionality
>
> Unfortunately, you can't add an attribute and expect it to be available 
> in the FTL.  Instead you'd have to change the tag library and extend the 
> class or create your own to support the additional attribute.  Take a 
> look at the source for FieldError.java
>
> Perhaps all you really need is <s:set> or <s:push>.
> http://struts.apache.org/2.0.9/docs/set.html
> ie. Set a value before <s:fielderrors> and modify the template for 
> FieldError to get it.
>
> hope that helps,
> Jeromy Evans
>
> afp wrote:
>   
>> Guys any ideas on how to do the below??
>>
>>
>>
>> afp wrote:
>>   
>>     
>>> Reposting as last post was not very clear
>>>
>>> Hi,
>>>
>>>    I am trying to add some custom parameters/attributes to the struts2
>>> tags like <s:fielderrors /> etc...
>>>
>>> Some tihing like the below wud have been perfect
>>>
>>> <s:fielderrors abc="def" />
>>>
>>> and I shud be able to access the parameter abc from within the ftl file
>>> like this 
>>> <#if parameters.abc?exists && parameters.abc == "def">
>>>  ${parameters.abc}
>>> </#if> 
>>>
>>> This is not quite happenning for me, I tried giving the additional
>>> parameter using the <s:param /> tag 
>>> <s:fielderrors>
>>>   <s:param name="abc" value="dec" />
>>> </s:fielderrors?
>>> but still I am not able to access the passed parameter in the ftl file
>>>       
> and
>   
>>> the condition always fails.
>>>
>>> Can anyone let me know on how I can pass on extra parameters to an ftl
>>> file and access it in the ftl file.
>>>
>>> TIA,
>>> Arup
>>>
>>>
>>>     
>>>       
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>   


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


Mime
View raw message