aspose file tools*
The moose likes JSP and the fly likes Clarrifications on EL function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Clarrifications on EL function" Watch "Clarrifications on EL function" New topic
Author

Clarrifications on EL function

Thennam Pandian
Ranch Hand

Joined: Oct 11, 2005
Posts: 163
Hi All,

I am new to EL in JPS. i try to run the following EL function.



/*********************/
DiceRoller.tld
/**********************/

<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<tablib >

<tlib-version>1.2</tlib-version>
<jspversion>2.0</jspversion>

<uri>DiceRoller</uri>

<function>
<name>rollIt</name>
<function-class>com.study.DiceRoller</function-class>
<function-signature>int roll()</function-signature>
</function>
</tablib>


/******************************************/
Jsp file to call the EL function
/******************************************/

<%@ page isELIgnored="false" %>
<%@ taglib prefix="mine" uri="DiceRoller" %>

${mine.rollIt()}



/******************************************/
DiceRoller.java
/******************************************/

package com.study;

public class DiceRoller {

public static int roll() {

return (int) (Math.random());
}

}


i am getting the following error.

The function rollIt must be used with a prefix when a default namespace is not specified
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61007
    
  65

${mine.rollIt()}

Is a period the correct delimiter to follow a namespace?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Thennam Pandian
Ranch Hand

Joined: Oct 11, 2005
Posts: 163
hi,

I am new to this EL function, just i copied the example given in HeadFirstJSP&Servlet.

Please help me to solve this issue.

i don't know about the namespace?
Prasad Tamirisa
Ranch Hand

Joined: Mar 26, 2007
Posts: 130
I am new to this EL function, just i copied the example given in HeadFirstJSP&Servlet.


Hi There,
You have not copied it correctly. Please go check it again. To give you a head's up about namespace,it is nothing but a nick name you use as a prefix to call every function defined in the taglib.

For example: In case of jsp is the nick name and the forward is a public static function defined some where and mapped accordingly in the taglib. But, you should observe that, they have used collon operator to call a function in the taglib.Whereas you have used period operator.

So, try the following. It should word.

This is what exactly Bear meant to say.
[ May 24, 2008: Message edited by: Prasad Tamirisa ]

Regards,
Durga Prasad
Prasad Tamirisa
Ranch Hand

Joined: Mar 26, 2007
Posts: 130
Javaranch suggests to use UBB Code tags to post code. Please use them from the next time.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Clarrifications on EL function