struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jennie Moeller" <Jennie.Moel...@bbc.co.uk>
Subject RE: Custom Tag lib passing c:out tags
Date Mon, 01 Oct 2007 11:34:15 GMT
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


Mime
View raw message