custom jsp tag library attributes some working others not

[nobr]I have a custom tag library that I am trying to pass a parameter to. Some parameters can be passed but others can not. For example:

<%@ taglib uri="/taglib/blah.tld" prefix="blah" %>

<blah:simple selectid="<%=new Date().toGMTString()%>"/>

returns

23 Jul 2007 22:11:42 GMT

<blah:simple selectid="<%=request.getAttributeNames().toString()%>"/>

returns

java.util.Vector$1@e5d9d2

But when ido something likethis:

<blah:simple selectid="<%=((NameBean)request.getAttribute("NameBean")).getFname()%>"/>

the jsp returns

<blah:simple selectid="Jeff"/>

The name is right but I want to evaluate the expression not just display a tag.

My workaround is todothis:

<%

String myname =((NameBean)request.getAttribute("NameBean")).getFname()

%>

<blah:simple selectid="<%= myname %>"/><br>

which returns the correct value ... Jeff

my tld is defined likethis:

...

<tag>

<name>simple</name>

<tagclass>com.mycompany.blahtag </tagclass>

<bodycontent>empty</bodycontent>

<info></info>

<attribute>

<name>selectid</name>

<required>true</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

...

Any thoughts? I am using jdk 1.4x and weblogic 8?[/nobr]

[1830 byte] By [jeff_chisma] at [2007-11-27 11:28:37]
# 1

So you're writing your own tag library but you aren't using the standard tag libraries? I think you would find it much easier if you used the standard tag libraries.

DrClapa at 2007-7-29 16:23:11 > top of Java-index,Java Essentials,New To Java...
# 2

[nobr]This is a really simplified example of what I am doing. The tag is going to be used for an ajaxified html select. There are some third party taglibs that would help with this but I am not allowed to use them.

The real question is what is the difference between A and B below. B works but A does not work. Is there a scope issue, protection issue, etc? There are no errors in the server log. For some reason in instance "A" my tag code is not called but the expression is evaluated.

A:

<blah:simple selectid="<%=((NameBean)request.getAttribute("NameBean")).getFname()%>"/>

returns

<blah:simple selectid="Jeff"/>

B:

<%

String myname =((NameBean)request.getAttribute("NameBean")).getFname()

%>

<blah:simple selectid="<%= myname %>"/><br>

returns

Jeff

[/nobr]

jeff_chisma at 2007-7-29 16:23:11 > top of Java-index,Java Essentials,New To Java...