Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pass values from JSP to TagLib attributes dynamicaly

 
marek duda
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, could you write the tld entry for this tag.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much!
now i understand this <rtxexprvalue> tag
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic