You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jennie Moeller <Je...@bbc.co.uk> on 2007/10/01 13:34:15 UTC

RE: Custom Tag lib passing c:out tags

FYI I found a solution if anyone else has this issue:

In the custom tag lib where you set your Parameter you need to include
this code:

try {
            parameter = (String)
ExpressionUtil.evalNotNull("encodechars", "parameter", value,
String.class, this, pageContext);
        } catch (Exception ex) {
            parameter = null;
        }

Then in the tag you can just do the following:

<mytag:encodechars parameter="${rForm.shortTitle}"/>

-----Original Message-----
From: Jennie Moeller [mailto:Jennie.Moeller@bbc.co.uk] 
Sent: 01 October 2007 10:39
To: Struts Users Mailing List
Subject: Custom Tag lib passing c:out tags

I have a custom tag lib i call passing a parameter of a c:out tag.
 
We don't have jsp expression lang supported so i have to use the c:out
tag to pass the variable into the custom tag but it doesnt' like it.
 
here is my tag:
 
<tag>
        <name>encodechars</name>
        <tagclass>com.web.taglib.EncodeCharsTag</tagclass>
        <bodycontent>empty</bodycontent>
        <info>
            Encodes numeric entities to html entities
        </info>
        <attribute>
            <name>parameter</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>
 
 
This is how i call it;
 
<mytag:encodechars parameter="<c:out value='${rForm.shortTitle}'/>"/>
 
But it passes "<c:out value='${rForm.shortTitle}'/>" as a string rather
than the actual value of it.
 
Any ideas?
jennie


This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.


This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.

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