• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

TLD example in HFSJ

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In HFSJ, there is a example for writing functions in TLD.
Example on page 389.

--------------------------------------
Code in TLD:


<description>JSTL 1.1 functions library</description>
<display-name>JSTL functions</display-name>
<tlib-version>1.1</tlib-version>
<short-name>mine</short-name>
<uri>DiceFunctions</uri>

<function>
<description>
User defined TLD.
</description>
<name>rollIt</name>
<function-class>com.scwcd.apps.util.DiceRoller</function-class>
<function-signature>int rollIt()</function-signature>
</function>

Code on JSP:

<%@ taglib prefix="mine" uri="DiceFunctions"%>
${mine.rollIt()}
I get error :

The function rollIt must be used with a prefix when a default namespace is not specified

But if i change the code to --> ${mine.rollIt} // here the brackets are removed. I do not get any error but i also do not get any output.

----------------------------------------------------

Thanks in advance.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
${mine:rollIt()} should be correct.
Try it so.

${mine.rollIt} works but you don't have any output because "mine" attribute is searched for in any scope but it doesn't exist and null value in output bacomes an empty string

Bye.
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic