wood burning stoves 2.0*
The moose likes JSP and the fly likes How to pass values from JSP to TagLib attributes dynamicaly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to pass values from JSP to TagLib attributes dynamicaly" Watch "How to pass values from JSP to TagLib attributes dynamicaly" New topic
Author

How to pass values from JSP to TagLib attributes dynamicaly

marek duda
Greenhorn

Joined: Sep 18, 2003
Posts: 10
HI there
first of all thank you for your help, I have already read a lot in your forums and learned a lot too!
here my problem:
i want a jsp page to pass attributes to a taglib dynamicaly
my tld file looks like that:
<!DOCTYPE taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1.1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>mdu tags</shortname>
<uri></uri>
<info>Tag Library Marek</info>
<tag>
<name>treeview</name>
<tagclass>com.mdu.projects.treeview.MduTreeView</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>expandPath</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
my jsp page looks like that:
<%@ taglib uri="/WEB-INF/mdutags.tld" prefix="mdutags" %>
<HTML stuff...>
<%!
String test = "1,2,3,4";
%>
<mdutags:treeview expandPath="<%= test %>" /> <.../HTML stuff...>
The String expandPath in my "Treeview" is "<%= test %>" not "1,2,3,4"
does anyone know what i am doing wrong?what have i to do pass jsp variables to taglibs?
greetings,
sorry for my clumsy english
Marek
Evaristo Ballorca
Greenhorn

Joined: Feb 13, 2002
Posts: 17
Hello, could you write the tld entry for this tag.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Marek, the tag mechanism is doing exactly what you told it to do.
With

you told the tag mechamism not to accept run-time expressions. If you want to be able to use run-time expressions for the attribute, you need to change the setting to "true".
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Welcome to the Ranch eballosa!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Fourm Bartender
marek duda
Greenhorn

Joined: Sep 18, 2003
Posts: 10
Thank you very much!
now i understand this <rtxexprvalue> tag
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass values from JSP to TagLib attributes dynamicaly