• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to pass values from JSP to TagLib attributes dynamicaly

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, could you write the tld entry for this tag.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much!
now i understand this <rtxexprvalue> tag
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic