struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Don Brown (JIRA)" <j...@apache.org>
Subject [jira] Updated: (WW-1811) Add generic custom tag attributes to pass custom parameters into a tag
Date Thu, 12 Jun 2008 23:58:05 GMT

     [ https://issues.apache.org/struts/browse/WW-1811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Don Brown updated WW-1811:
--------------------------

    Fix Version/s:     (was: 2.1.3)
                   2.2.x

> Add generic custom tag attributes to pass custom parameters into a tag
> ----------------------------------------------------------------------
>
>                 Key: WW-1811
>                 URL: https://issues.apache.org/struts/browse/WW-1811
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Tags
>    Affects Versions: 2.0.6
>            Reporter: Jonathan Koppenhofer
>            Priority: Minor
>             Fix For: 2.2.x
>
>
> It would be nice to have a generic struts tag attribute for all tags to pass in custom
parameters into the tag to use within custom templates.
> For example. I want to enable field level "mode" capabilites similar to what can be done
in Struts-Layout (http://struts.application-servers.com) for struts 1.1-1.3. This includes
the ability to specify a mode (Editable, ReadOnly. Hidden, etc...) for a field dependent on
what mode (Create, Edit, Read) the page is in. An example struts-tag could be:
> <s:textfield key="firstName" somecustommodeattribute="E,E,I"/>
> In the example above "E,E,I" stands for... If page is in create mode the field is editable,
if the field is in edit mode the field is ediatble, if the page is in read mode the field
is readonly (inspect)
> I extended the simple text.ftl to be like:
> <#if parameters.somecustommodeattribute?exists>
>   <#assign modeKey = 0/>
>   <#if Session.pageMode?exists>
>     <#assign modeKey = Session.pageMode?int/>
>   </#if>
>   <#if Request.pageMode?exists>
>     <#assign modeKey = Request.pageMode?int/>
>   </#if>
>   <#assign fieldMode = parameters.somecustommodeattribute?substring(modeKey,modeKey+1)/>
> <#else>
>   <#assign fieldMode = "E"/>
> </#if>
> <#if !(fieldMode = "N") >
> 	<#if fieldMode = "E" >
> 		<input type="text"<#rt/>
> 		 name="${parameters.name?default("")?html}"<#rt/>
> 		<#if parameters.get("size")?exists>
> 		 size="${parameters.get("size")?html}"<#rt/>
> 		</#if>
> 		<#if parameters.maxlength?exists>
> 		 maxlength="${parameters.maxlength?html}"<#rt/>
> 		</#if>
> 		<#if parameters.nameValue?exists>
> 		 value="<@s.property value="parameters.nameValue"/>"<#rt/>
> 		</#if>
> 		<#if parameters.disabled?default(false)>
> 		 disabled="disabled"<#rt/>
> 		</#if>
> 		<#if parameters.readonly?default(false)>
> 		 readonly="readonly"<#rt/>
> 		</#if>
> 		<#if parameters.tabindex?exists>
> 		 tabindex="${parameters.tabindex?html}"<#rt/>
> 		</#if>
> 		<#if parameters.id?exists>
> 		 id="${parameters.id?html}"<#rt/>
> 		</#if>
> 		<#if parameters.cssClass?exists>
> 		 class="${parameters.cssClass?html}"<#rt/>
> 		</#if>
> 		<#if parameters.cssStyle?exists>
> 		 style="${parameters.cssStyle?html}"<#rt/>
> 		</#if>
> 		<#if parameters.title?exists>
> 		 title="${parameters.title?html}"<#rt/>
> 		</#if>
> 		<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> 		<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
> 		/>
> 	<#else>
> 		<#include "/${parameters.templateDir}/simple/hidden.ftl" />
> 		<#if fieldMode = "I" >
> 			<@s.property value="parameters.nameValue"/>
> 		</#if>
> 	</#if>
> </#if>
> Now granted this is a very specific example, but it would just be nice to have a generic
parameter that I can access in my ftl templates.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message