struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <>
Subject Re: Adding additional parameters to struts 2 tags and accessing them in the ftl files
Date Thu, 30 Aug 2007 05:33:49 GMT
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

Perhaps all you really need is <s:set> or <s:push>.
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 && == "def">
>>  ${}
>> </#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:
For additional commands, e-mail:

View raw message